avrora.sim
Class Simulator.Printer

java.lang.Object
  extended byavrora.sim.Simulator.Printer
Enclosing class:
Simulator

public class Simulator.Printer
extends java.lang.Object

The Simulator.Printer class is a printer that is tied to a specific Simulator instance. Being tied to this instance, it will always report the node ID and time before printing anything. This simple mechanism allows the output to be much cleaner to track the output of multiple nodes at once.


Field Summary
 boolean enabled
          The enabled field is true when this printer is enabled.
 
Method Summary
 void println(java.lang.String s)
          The println() method prints the node ID, the time, and a message to the console, synchronizing with other threads so that output is not interleaved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public boolean enabled
The enabled field is true when this printer is enabled. When this printer is not enabled, the println() method SHOULD NOT BE CALLED.

Method Detail

println

public void println(java.lang.String s)
The println() method prints the node ID, the time, and a message to the console, synchronizing with other threads so that output is not interleaved. This method SHOULD ONLY BE CALLED WHEN enabled IS TRUE! This is done to prevent performance bugs created by string construction inside printing (and debugging code).

Parameters:
s - the string to print