organisms
Class zebra

java.lang.Object
  |
  +--organisms.organisms
        |
        +--organisms.animals
              |
              +--organisms.herbivores
                    |
                    +--organisms.zebra

public final class zebra
extends herbivores

H klash twn zebras.

Invariant: Prepei na thrountai oles oi invariant synthikes ths klashs herbivores. Dhladh mia egkyrh zebra prepei na einai ena egkyro fytofago zwo.

Statika pedia ths klashs: alive_zebras: Poses zebras einai zwntanes, dead_zebras: Poses zebras exoun pethanei


Field Summary
 
Fields inherited from class organisms.herbivores
alive_herbivores, 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
zebra(int x, int y, javax.swing.ImageIcon im)
          Constructor ths klashs zebras.
 
Method Summary
static int alive_zebras()
          Epistrefei ton arithmo twn zwntanwn zebras Accesor - Selector.
static int dead_zebras()
          Epistrefei ton arithmo twn nekrwn zebras Accesor - Selector.
 void die()
          Kaleitai otan pethainei mia zebra kai meiwnei oles tis static metavlites pou deixnoun tous zwntanous organismous twn kathgoriwn pou auto anhkei, enw antistoixa auksanei oles tis static metavlites pou deixnoun tou nekrous organismous twn kathgoriwn autwn.
static void initStats()
          Arxikopoiei ta statistika se authn thn klash.
 
Methods inherited from class organisms.herbivores
alive_herbivores, dead_herbivores, eat
 
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, 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
 

Constructor Detail

zebra

public zebra(int x,
             int y,
             javax.swing.ImageIcon im)
Constructor ths klashs zebras. Dhmiourgei mia nea zebra sthn thesh x,y. Orizei to growth_rate, to foodPerWeek kai to arxiko energy gia oles tis zebras kai auksanei tis synolikes zwntanes zebras kata 1.

Precondition: Prepei na dwthei egkyrh thesh, dhaldh ta x,y na einai x>=0 , y>=0 x kai y mesa sta oria tou xarth kai sthn thesh auth na mhn yparxei allos organismos.

Postcondition: Dhmiourgeitai mia nea zebra me to orismeno growth_rate, foodPerWeek kai arxiko energy sthn thesh x,y.

Parameters:
x - H syntetagmenh x ths theshs pou theloume na eisagoume th nea zebra.
y - H syntetagmenh y ths theshs pou theloume na eisagoume th nea zebra.
im - To eikonidio ths zebras.
Method Detail

alive_zebras

public static int alive_zebras()
Epistrefei ton arithmo twn zwntanwn zebras Accesor - Selector.

Postcondition: Epistrefei ton arithmo twn zwntanwn zebras

Returns:
ton arithmo twn zwntanwn zebras

dead_zebras

public static int dead_zebras()
Epistrefei ton arithmo twn nekrwn zebras Accesor - Selector.

Postcondition: Epistrefei ton arithmo twn nekrwn zebras

Returns:
ton arithmo twn nekrwn zebras

die

public void die()
Kaleitai otan pethainei mia zebra kai meiwnei oles tis static metavlites pou deixnoun tous zwntanous organismous twn kathgoriwn pou auto anhkei, enw antistoixa auksanei oles tis static metavlites pou deixnoun tou nekrous organismous twn kathgoriwn autwn. Transformer - Mutative. Ylopoiei thn abstract methodo die() ths klashs organisms. Prepei na kaleitai gia tou nekrous organismous kata thn diarkeia ths proswmoiwshs kathe mera.

Precondition: O organismos prepei na exei pethanei, dhladh !this.isAlive().

Postcondition: Meiwnetai kata 1 to plhthos twn zwntanwn organismwn kai auksanetai kata 1 to plhthos twn nekrwn organismwn. (oi static metavlites olwn twn kathgoriwn pou anhkei o organismos pou pethainei)

Specified by:
die in class organisms

initStats

public static void initStats()
Arxikopoiei ta statistika se authn thn klash. Transformer - Mutative.

Postcondition: Arxikopoiei ta statistika se authn thn klash.