jasi.sim.user
Class BasicOutput

java.lang.Object
  extended by jasi.sim.user.BasicOutput
All Implemented Interfaces:
SimListener, ElementsListener, CalendarListener

public class BasicOutput
extends java.lang.Object
implements SimListener

Simple output and error output for simulation into files.


Constructor Summary
BasicOutput(java.io.PrintWriter output, java.io.PrintWriter error)
          Constructor for SimpleOutput.
 
Method Summary
 void advancedTime(Time time, double speed)
          A time advance has been granted.
 void changedElement(Element element, java.lang.String name, java.lang.Object value)
          A simulation element has changed its state.
static BasicOutput create()
          Factory method for SimpleOutput.
static BasicOutput create(java.lang.String output, java.lang.String error)
          Factory method for SimpleOutput.
 void createdElement(Element element)
          A simulation element has been created.
 void deletedElement(Element element)
          A simulation element has been deleted.
protected  void finalize()
          Destructor of simulation output:
 void finishedReadingArchive()
          The simulation archive was read.
 void finishedSimulation(Time time)
          A simulation thread has been finished.
 void finishedWritingArchive()
          The simulation archive was written.
 void gotException(java.lang.Exception e)
          An exception occured during simulation.
 void gotMessage(java.lang.String m)
          An message was created by the simulation.
 void poppedEvent(Event event)
          An event has been popped from the calendar and executed by the simulation.
 void pushedEvent(Event event)
          An event has been pushed to the simulation calendar.
 void removedEvent(Event event)
          An event has been removed from the simulation calendar.
 void requestedElement(Element element, java.lang.String name, java.lang.Object value)
          The attribute value of a simulation element has been read.
 void startedSimulation(Time time)
          A simulation thread has been started.
 void startReadingArchive(java.lang.String file)
          The simulation archive is read.
 void startWritingArchive(java.lang.String file)
          The simulation archive is written.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicOutput

public BasicOutput(java.io.PrintWriter output,
                   java.io.PrintWriter error)
Constructor for SimpleOutput.

Parameters:
output - The file name of the simulation output.
error - The file name of the simulation error output.
Method Detail

create

public static BasicOutput create()
Factory method for SimpleOutput.

Returns:
An instance of this class

create

public static BasicOutput create(java.lang.String output,
                                 java.lang.String error)
Factory method for SimpleOutput.

Parameters:
output - The file name of the simulation output.
error - The file name of the simulation error output.
Returns:
An instance of this class

finalize

protected void finalize()
                 throws java.lang.Throwable
Destructor of simulation output:

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - An error while finalizing.

pushedEvent

public void pushedEvent(Event event)
An event has been pushed to the simulation calendar.

Specified by:
pushedEvent in interface CalendarListener
Parameters:
event - The pushed event.

poppedEvent

public void poppedEvent(Event event)
An event has been popped from the calendar and executed by the simulation.

Specified by:
poppedEvent in interface CalendarListener
Parameters:
event - The executed event.

removedEvent

public void removedEvent(Event event)
An event has been removed from the simulation calendar.

Specified by:
removedEvent in interface CalendarListener
Parameters:
event - The removed event.

startedSimulation

public void startedSimulation(Time time)
A simulation thread has been started.

Specified by:
startedSimulation in interface SimListener
Parameters:
time - The current time.

finishedSimulation

public void finishedSimulation(Time time)
A simulation thread has been finished.

Specified by:
finishedSimulation in interface SimListener
Parameters:
time - The current time.

createdElement

public void createdElement(Element element)
A simulation element has been created.

Specified by:
createdElement in interface ElementsListener
Parameters:
element - The newly created element.

changedElement

public void changedElement(Element element,
                           java.lang.String name,
                           java.lang.Object value)
A simulation element has changed its state.

Specified by:
changedElement in interface ElementsListener
Parameters:
element - The newly created element.
name - The attribute's name.
value - The new value of the attribute.

requestedElement

public void requestedElement(Element element,
                             java.lang.String name,
                             java.lang.Object value)
The attribute value of a simulation element has been read.

Specified by:
requestedElement in interface ElementsListener
Parameters:
element - The simulation element.
name - The attribute's name.
value - The value of the attribute.

deletedElement

public void deletedElement(Element element)
A simulation element has been deleted.

Specified by:
deletedElement in interface ElementsListener
Parameters:
element - The deleted element.

advancedTime

public void advancedTime(Time time,
                         double speed)
A time advance has been granted.

Specified by:
advancedTime in interface SimListener
Parameters:
time - The granted time advance.
speed - The simulation speed in factors of real time.

startReadingArchive

public void startReadingArchive(java.lang.String file)
The simulation archive is read.

Specified by:
startReadingArchive in interface SimListener
Parameters:
file - The file name of the archive.

finishedReadingArchive

public void finishedReadingArchive()
The simulation archive was read.

Specified by:
finishedReadingArchive in interface SimListener

startWritingArchive

public void startWritingArchive(java.lang.String file)
The simulation archive is written.

Specified by:
startWritingArchive in interface SimListener
Parameters:
file - The file name of the archive.

finishedWritingArchive

public void finishedWritingArchive()
The simulation archive was written.

Specified by:
finishedWritingArchive in interface SimListener

gotException

public void gotException(java.lang.Exception e)
An exception occured during simulation.

Specified by:
gotException in interface SimListener
Parameters:
e - The exception.

gotMessage

public void gotMessage(java.lang.String m)
An message was created by the simulation.

Specified by:
gotMessage in interface SimListener
Parameters:
m - The message.