|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGraphView
public class GraphView
The GraphView provides a view of two populations of actors in the field as a line graph over time. In its current version, it can only plot exactly two different classes of animals. If further animals are introduced, they will not currently be displayed.
Nested Class Summary | |
---|---|
(package private) class |
GraphView.GraphPanel
Nested class: a component to display the graph. |
Constructor Summary | |
---|---|
GraphView(int width,
int height,
int startMax)
Constructor. |
Method Summary | |
---|---|
boolean |
isViable(Field field)
Determine whether the simulation should continue to run. |
void |
reset()
Prepare for a new run. |
void |
setColor(Class animalClass,
Color color)
Define a color to be used for a given class of animal. |
void |
showStatus(int step,
Field field)
Show the current status of the field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphView(int width, int height, int startMax)
width
- The width of the plotter window (in pixles).height
- The height of the plotter window (in pixles).startMax
- The initial maximum value for the y axis.world
- The world object.class1
- The first class to be plotted.width
- The second class to be plotted.Method Detail |
---|
public boolean isViable(Field field)
isViable
in interface SimulatorView
public void reset()
reset
in interface SimulatorView
public void setColor(Class animalClass, Color color)
setColor
in interface SimulatorView
animalClass
- The animal's Class object.color
- The color to be used for the given class.public void showStatus(int step, Field field)
showStatus
in interface SimulatorView
step
- Which iteration step it is.field
- The field whose status is to be displayed.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |