public class PondLife
extends java.lang.Object
PondLife Java application runs a simple simulation that
models the fish and weeds in a pond.
The simulation is currently set up to use these values:
Java Source Code for this class: http://www.cs.colorado.edu/~main/applications/PondLife.java
| Modifier and Type | Field and Description |
|---|---|
static int |
AVERAGE_NIBBLES |
static double |
BIRTH_RATE |
static double |
FISH_SIZE |
static double |
FRACTION |
static int |
INIT_FISH |
static int |
MANY_WEEDS |
static int |
MANY_WEEKS |
static double |
WEED_RATE |
static double |
WEED_SIZE |
| Constructor and Description |
|---|
PondLife() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
Run the simulation, using the values indicated in the documentation.
|
static void |
pondWeek(java.util.Vector<Herbivore> fish,
java.util.Vector<Plant> weeds)
Simulate one week of life in the pond, using the values indicated in the
documentation.
|
static <T extends Organism> |
totalMass(java.util.Vector<T> organisms)
Calculate the total mass of a collection of
Organisms. |
public static final int MANY_WEEDS
public static final double WEED_SIZE
public static final double WEED_RATE
public static final int INIT_FISH
public static final double FISH_SIZE
public static final double FRACTION
public static final int AVERAGE_NIBBLES
public static final double BIRTH_RATE
public static final int MANY_WEEKS
public static void main(java.lang.String[] args)
args - not used in this implementationpublic static void pondWeek(java.util.Vector<Herbivore> fish, java.util.Vector<Plant> weeds)
fish - Vector of fish that are in the pond at the start of the weekweeds - Vector of weeds that are in the pond at the start of the weekpublic static <T extends Organism> double totalMass(java.util.Vector<T> organisms)
Organisms.T - component type of the elements in the organisms Vector
Precondition:
Every object in organisms is an Organism.organisms - a Vector of Organism objectsOrganism (in ounces).