fishPond
Class Plant

java.lang.Object
  extended by fishPond.Plant

public class Plant
extends java.lang.Object

The state of a plant includes it's position (row and column) and it's size.

A Plant grows over time. Plants are eaten by fish that pass over them.

Author:
Put Your Name Here

Field Summary
static int MAX_PLANT_SIZE
          Maximum size for a plant
static int PLANT_BITE_SIZE
          Portion of plant that is eaten by a fish passing over it
static int PLANT_STARTING_SIZE
          Initial size of plants in beginning of simulation
 
Constructor Summary
Plant(int rowIn, int colIn, int size)
          Standard constructor that merely initializes the fields from the parameters
Plant(Plant other)
          Standard copy constructor that merely copies the fields
 
Method Summary
 int getCol()
          returns column
 int getRow()
          returns row
 int getSize()
          returns size
 void grow()
          increments size by one unit
 boolean isAlive()
          returns true if size is bigger than zero, false otherwise.
 void removeBite(int biteSize)
          decreases size by biteSize units
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLANT_STARTING_SIZE

public static final int PLANT_STARTING_SIZE
Initial size of plants in beginning of simulation

See Also:
Constant Field Values

MAX_PLANT_SIZE

public static final int MAX_PLANT_SIZE
Maximum size for a plant

See Also:
Constant Field Values

PLANT_BITE_SIZE

public static final int PLANT_BITE_SIZE
Portion of plant that is eaten by a fish passing over it

See Also:
Constant Field Values
Constructor Detail

Plant

public Plant(int rowIn,
             int colIn,
             int size)
Standard constructor that merely initializes the fields from the parameters


Plant

public Plant(Plant other)
Standard copy constructor that merely copies the fields

Method Detail

isAlive

public boolean isAlive()
returns true if size is bigger than zero, false otherwise.


getRow

public int getRow()
returns row


getCol

public int getCol()
returns column


getSize

public int getSize()
returns size


grow

public void grow()
increments size by one unit


removeBite

public void removeBite(int biteSize)
decreases size by biteSize units



Web Accessibility