|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--organisms.organisms
|
+--organisms.animals
|
+--organisms.herbivores
H klash herbivores einai yperklash olwn twn fytofagwn zwwn kai ypoklash ths animals. Einai abstract kai kathe klash kapoiou fytofagou zwou einai katw apo authn sthn ierarxia.
Invariant: Prepei na thrountai oles oi invariant synthikes ths klashs animals. Dhladh ena egkyro fytofago zwo prepei na einai ena egkyro zwo.
Statika pedia ths klashs: alive_herbivores: Posa fytofaga zwa einai zwntana, dead_herbivores: Posa fytofaga zwa exoun pethanei
| Field Summary | |
protected static int |
alive_herbivores
|
protected static int |
dead_herbivores
|
| Fields inherited from class organisms.animals |
alive_animals, dead_animals, eatenThisWeek, foodPerWeek |
| Fields inherited from class organisms.organisms |
age, alive_organisms, dead_organisms, energy, growth_rate, im, isChosen, position |
| Constructor Summary | |
herbivores()
Constructor ths abstract klashs herbivores. |
|
| Method Summary | |
static int |
alive_herbivores()
Epistrefei ton arithmo twn zwntanwn fytofagwn. |
static int |
dead_herbivores()
Epistrefei ton arithmo twn nekrwn fytofagwn. |
boolean |
eat(organisms.organisms o)
Elegxei an to fytofago zwo trwei ton organismo o pou dinetai san orisma, kai an ton trwei tote auksanetai to eatenThisWeek tou fytofagou kata oso einai to growth_rate tou organismou o kai meiwnetai kata to idio poso to energy tou organismou o. |
static void |
initStats()
Arxikopoiei ta statistika se authn thn klash. |
| Methods inherited from class organisms.animals |
alive_animals, dead_animals, eatenThisWeek, foodPerWeek, increase_eatenThisWeek, move, reset_eatenThisWeek, restoreEnergy |
| Methods inherited from class organisms.organisms |
age, alive_organisms, choose, dead_organisms, decrease_energy, die, draw, energy, growth_rate, increase_age, increase_energy, isAlive, position |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static int alive_herbivores
protected static int dead_herbivores
| Constructor Detail |
public herbivores()
Postcondition: Dhmiourgeitai ena neo fytofago zwo opoioudhpote typou me swsta xarakthristika organismou, kai auksanetai kata 1 to alive_herbivores.
| Method Detail |
public static int alive_herbivores()
Postcondition: Epistrefei ton arithmo twn zwntanwn fytofagwn.
public static int dead_herbivores()
Postcondition: Epistrefei ton arithmo twn nekrwn fytofagwn.
public boolean eat(organisms.organisms o)
Ena xortofago zwo trwei enan allo organismo o an:
1. autos einai fyto - o instanceOf plants- kai
2. einai se kontinh apostash -this.position.checkIfClose(o.position)-
An ton faei tote o.decrease_energy() kai this.increase_eatenThisWeek( o.growth_rate() ). Transformer - Mutative.
Precondition: To fytofago zwo prepei na einai zwntano, dhladh this.isAlive(), kai epishs o organismos o prepei na einai kai autos zwntanos, dhladh o.isAlive().
Postcondition: An to fytofago trwei ton organismo o synfwna me ta krithria 1,2 tote auksanetai to eatenThisWeek tou kata o.growth_rate kai meiwnetai to energy tou organismou o kata o.growth_rate(o.decrease_energy()). An oxi tote den ginetai tipota.
eat in class animalso - O organismos pou theloume na doume an tha fagwthei apo to fytofago zwo.
public static void initStats()
Postcondition: Arxikopoiei ta statistika se authn thn klash.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||