|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mates.sim.Experiment
A class for automating an experiment within MATES. Experiments can
have "sub-experiments," creating an experiment tree. This allows
for a sort of "plugin" interface for MATES. In other words, say
one implements a routing algorithm. This algorithm could be
encapsulated by one experiment. Afterward, this experiment could
be added as a sub-experiment to all other experiments that require
routing. All experiments within the same tree use the same Simulator
object. Any operation performed to an experiment that
is not at the root will first be propagated to the root.
For example, say iterate()
is called on a
sub-experiment. The call to iterate() will be propagated up
through the tree until it reaches the root. When it reaches the
root, the root will first iterate itself (and thereby the
Simulator), and then iterate each of its children.
Field Summary | |
protected Experiment |
parent
Reference to this experiment's parent. |
protected Simulator |
simulator
Reference to the simulator associated with this experiment tree. |
Constructor Summary | |
protected |
Experiment()
Creates a new Experiment, with a new Simulator. |
|
Experiment(Experiment parent)
Creates a new experiment as a sub-experiment of parent . |
protected |
Experiment(Simulator simulator)
Creates a new Experiment from an existing Simulator. |
Method Summary | |
boolean |
complete()
Returns true if the experiment is complete. |
java.awt.Component |
getGUI()
Returns the GUI component associated with this experiment. |
java.awt.Component[] |
getMenuItems()
Returns an array of menu items (usually in the form of JMenuItem s) to be added to the GUI for this
experiment. |
Experiment |
getParentExperiment()
Returns the parent experiment of this experiment. |
Simulator |
getSimulator()
Returns the simulator associated with this experiment tree. |
java.util.ArrayList |
getSubExperiments()
Returns an ArrayList containing all of this
experiment's sub-experiments. |
protected void |
handleInitialize()
Callback function for initializing the experiment. |
protected void |
handleIterate()
Callback function for iterating the experiment. |
void |
handleMenuAction(java.awt.event.ActionEvent e,
java.awt.Component frame)
Callback function for when one of this experiment's menu items is acted upon. |
protected void |
handleReset()
Callback function for resetting the experiment. |
void |
initialize()
Causes handleInitialize() to be called on all
experiments in this experiment tree. |
void |
iterate()
Causes the simulator to iterate itself, followed by calling handleIterate() on all experiments in this
experiment tree. |
void |
reset()
Causes the simulator to reset itself, followed by calling handleReset() on all experiments in this
experiment tree. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Simulator simulator
protected Experiment parent
null
,
this experiment is at the root of the experiment tree.
Constructor Detail |
protected Experiment()
protected Experiment(Simulator simulator)
public Experiment(Experiment parent)
parent
. The new experiment will inherit the
Simulator object of its parent.
Method Detail |
public Experiment getParentExperiment()
null
if
this experiment is at the root of the experiment tree.public java.util.ArrayList getSubExperiments()
ArrayList
containing all of this
experiment's sub-experiments. This is guaranteed not to be
null
.
public Simulator getSimulator()
public final void initialize()
handleInitialize()
to be called on all
experiments in this experiment tree.
protected void handleInitialize()
super.handleInitialize()
need not be called from
re-implementations of this function.
public final void iterate()
handleIterate()
on all experiments in this
experiment tree.
protected void handleIterate()
super.handleIterate()
need not be called from
re-implementations of this function.
public final void reset()
handleReset()
on all experiments in this
experiment tree.
protected void handleReset()
super.handleReset()
need not be called from
re-implementations of this function.
public boolean complete()
true
if the experiment is complete. By
default, this function always returns false
.
Classes extending Experiment should re-implement this function
to return true
when the experiment is complete.
Also, if this class is not the root of the experiment tree,
complete()
will instead return parent
.complete()
.
public java.awt.Component[] getMenuItems()
JMenuItem
s) to be added to the GUI for this
experiment. By default, this function returns
null
.
public java.awt.Component getGUI()
GraphicalUserInterface
is used.
This function defaults to return null
.
getGUI()
is intended for child classes that extend
Experiment
to re-implement this function and
return a GUI object.
public void handleMenuAction(java.awt.event.ActionEvent e, java.awt.Component frame)
|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |