Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.gui
Class SingleNodeMonitor

    java.lang.Object
      avrora.gui.SingleNodeMonitor

All Implemented Interfaces:
  Simulation.Monitor

Direct Known Subclasses:
  VisualStackMonitor

public abstract class SingleNodeMonitor
extends java.lang.Object
implements Simulation.Monitor

There are two types of visual monitors for the GUI. First, there are single node monitors. Each time a monitor is added to a node, a new panel is created and each "instance" of this monitor gets its chalkboard/panel to draw on. Second, there are global monitors. Every time a global monitor is attached to a new node, one one total chalkboard/diplay panel is created. (e.g. a global monitor might have five nodes attached to it, but each node only writes to one central chalkboard).

This class is for the first type: single node monitors. It is a physical implementation of a monitor factory -> thus once inited, it can create nodes on command.

Since many of the single node monitors are very similar is data collection and display (just a few lines are different in the actual data collection), most single node monitors can just use this class as a factory.

Nested Class Summary
`protected class` | `SingleNodeMonitor.SingleNodePanel`

Constructor Summary
`SingleNodeMonitor(java.lang.String n)` Default constuctor, will init the hash maps that store information about the monitors in this node

Method Summary
`void` | `attach(Simulation sim, java.util.List nodes)` This actually informs our data structure that the list of nodes passed to this function want this monitor.
`void` | `construct(Simulation sim, Simulation.Node n, Simulator s)` This is called at the beginning of the simulation to physically create the nodes
`void` | `destruct(Simulation sim, Simulation.Node n, Simulator s)` This is called at the end of the simulation to remove any data structures associated with the nodes.
`protected abstract SingleNodeMonitor.SingleNodePanel` | `newPanel(Simulation.Node n, MonitorPanel p)`
`void` | `remove(Simulation sim, java.util.List nodes)` You can multiple remove nodes from a monitor using this function

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SingleNodeMonitor

    public SingleNodeMonitor(java.lang.String n)

  Default constuctor, will init the hash maps that store information about the monitors in this node

Method Detail

### attach

    public void attach(Simulation sim,
                       java.util.List nodes)

  This actually informs our data structure that the list of nodes passed to this function want this monitor. A display panel is created. Note that the monitors are NOT created by attach - you need to call init

  Specified by:
    `attach` in interface `Simulation.Monitor`
  Parameters:
    `nodes` - A list of the nodes that should be attached to the monitor

### construct

    public void construct(Simulation sim,
                          Simulation.Node n,
                          Simulator s)

  This is called at the beginning of the simulation to physically create the nodes

  Specified by:
    `construct` in interface `Simulation.Monitor`
  Parameters:
    `n` - The node the monitor is attached to
    `s` - The simulator that the monitor can be inserted into

### destruct

    public void destruct(Simulation sim,
                         Simulation.Node n,
                         Simulator s)

  This is called at the end of the simulation to remove any data structures associated with the nodes.

  Specified by:
    `destruct` in interface `Simulation.Monitor`
  Parameters:
    `n` - The node the monitor is attached to
    `s` - The simulator that the monitor can be inserted into

### remove

    public void remove(Simulation sim,
                       java.util.List nodes)

  You can multiple remove nodes from a monitor using this function

  Specified by:
    `remove` in interface `Simulation.Monitor`
  Parameters:
    `nodes` - A `List` of nodes that should be removed. If an element of the list is not already attached to the node, it will just skip that element.

### newPanel

    protected abstract SingleNodeMonitor.SingleNodePanel newPanel(Simulation.Node n,
                                                                  MonitorPanel p)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD