|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.Simulation.Node
The Node
class represents a node in a simulation, which has an ID and a program
to be loaded onto it. It also has a PlatformFactory
instance that is used to create
the actual Simulator
object when the simulation is begun.
Field Summary | |
int |
id
|
protected java.util.LinkedList |
monitors
|
protected LoadableProgram |
path
|
protected Platform |
platform
|
protected PlatformFactory |
platformFactory
|
protected Simulator |
simulator
|
protected SimulatorThread |
thread
|
Constructor Summary | |
protected |
Simulation.Node(int id,
PlatformFactory pf,
LoadableProgram p)
The constructor for the Node class creates a representation of a new node that
includes its id, a factory capable of creating a platform instance (i.e. microcontroller with
attached devices) and the program to be loaded onto the node. |
Method Summary | |
void |
addMonitor(Simulation.Monitor f)
The addMonitor() method is called by a Monitor when it attaches itself to this node. |
java.util.List |
getMonitors()
The getMonitors() method gets a list of monitors that are attached to this node. |
LoadableProgram |
getProgram()
The getProgram() method return a reference to the loadable program for this node. |
Simulation |
getSimulation()
The getSimulation() method returns a reference to the simulation instance which this
node is a part of. |
Simulator |
getSimulator()
The getSimulator() method returns the simulator instance for this node while it is
executing. |
SimulatorThread |
getThread()
|
protected void |
instantiate()
The instantiate() method is called when the simulation begins. |
protected void |
remove()
The remove() |
void |
removeMonitor(Simulation.Monitor f)
The removeMonitor() method is called by a Monitor when it removes itself from this node. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final int id
protected final LoadableProgram path
protected final PlatformFactory platformFactory
protected final java.util.LinkedList monitors
protected Platform platform
protected Simulator simulator
protected SimulatorThread thread
Constructor Detail |
protected Simulation.Node(int id, PlatformFactory pf, LoadableProgram p)
Node
class creates a representation of a new node that
includes its id, a factory capable of creating a platform instance (i.e. microcontroller with
attached devices) and the program to be loaded onto the node. The constructor does not yet
instantiate the node, but leaves the node in an unconstructed state (i.e. the simulator and
microcontroller and external devices for the node have not been allocated and initialized yet).
id
- the unique id of the nodepf
- the platform factory that will be used to instantiate the nodep
- the program to load onto the microcontrollerMethod Detail |
protected void instantiate()
instantiate()
method is called when the simulation begins. When the node is
created (i.e the constructor is called), it is left in an unconstructed state. The role of this
method is to create the simulator, the microcontroller, and external devices for the node that will
be actually executing in the simulation.
public Simulator getSimulator()
getSimulator()
method returns the simulator instance for this node while it is
executing. When the node is not currently executing (i.e. the simulation has not started yet),
this method will return null.
public Simulation getSimulation()
getSimulation()
method returns a reference to the simulation instance which this
node is a part of.
public void addMonitor(Simulation.Monitor f)
addMonitor()
method is called by a Monitor when it attaches itself to this node. More
specifically, the model is that a Monitor is attached to a list of nodes; the monitor itself decides
which of those nodes to attach to and, for each one, calls this method.
f
- the monitor being added to this nodepublic void removeMonitor(Simulation.Monitor f)
removeMonitor()
method is called by a Monitor when it removes itself from this node.
f
- the monitor being removed from this nodepublic java.util.List getMonitors()
getMonitors()
method gets a list of monitors that are attached to this node.
public LoadableProgram getProgram()
getProgram()
method return a reference to the loadable program for this node.
protected void remove()
remove() method is called on a node when it is being removed from the simulation.
public SimulatorThread getThread()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |