organisms
Class bush

java.lang.Object
  |
  +--organisms.organisms
        |
        +--organisms.plants
              |
              +--organisms.bush

public final class bush
extends plants

H klash twn bushes.

Invariant: Prepei na thrountai oles oi invariant synthikes ths klashs plants. Dhladh enas egkyro bush prepei na einai ena egkyro fyto.

Statika pedia ths klashs: alive_bushes: Posoi bushes einai zwntanoi, dead_bushes: Posoi bushes exoun pethanei


Field Summary
 
Fields inherited from class organisms.plants
alive_plants, dead_plants
 
Fields inherited from class organisms.organisms
age, alive_organisms, dead_organisms, energy, growth_rate, im, isChosen, position
 
Constructor Summary
bush(int x, int y, javax.swing.ImageIcon im)
          Constructor ths klashs bushes.
 
Method Summary
static int alive_bushes()
          Epistrefei ton arithmo twn zwntanwn bushes Accesor - Selector.
static int dead_bushes()
          Epistrefei ton arithmo twn nekrwn bushes Accesor - Selector.
 void die()
          Kaleitai otan pethainei enas bush 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.plants
alive_plants, dead_plants, 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

bush

public bush(int x,
            int y,
            javax.swing.ImageIcon im)
Constructor ths klashs bushes. Dhmiourgei enan neo bush sthn thesh x,y. Orizei to growth_rate, to foodPerWeek kai to arxiko energy gia olous tous bushes kai auksanei tous synolikous zwntanous bushes 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 enas neos bush me to orismeno growth_rate, foodPerWeek kai arxiko energy sthn thesh x,y.

Parameters:
x - H syntetagmenh x ths theshs pou theloume na eisagoume ton neo bush.
y - H syntetagmenh y ths theshs pou theloume na eisagoume ton neo bush.
im - To eikonido tou thamnou.
Method Detail

alive_bushes

public static int alive_bushes()
Epistrefei ton arithmo twn zwntanwn bushes Accesor - Selector.

Postcondition: Epistrefei ton arithmo twn zwntanwn bushes

Returns:
ton arithmo twn zwntanwn bushes

dead_bushes

public static int dead_bushes()
Epistrefei ton arithmo twn nekrwn bushes Accesor - Selector.

Postcondition: Epistrefei ton arithmo twn nekrwn bushes

Returns:
ton arithmo twn nekrwn bushes

die

public void die()
Kaleitai otan pethainei enas bush 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.