Package ons

Class Tracer

java.lang.Object
ons.Tracer

public class Tracer
extends java.lang.Object
Generates a trace file that contains information about what happened during the simulation, such as arriving and departing flows, created lightpaths, and accepted or blocked flows.
  • Method Summary

    Modifier and Type Method Description
    void acceptFlow​(Flow flow, LightPath[] lightpaths)
    The event of an accepted flow object is added to the trace file.
    void add​(java.lang.Object o)
    Adds an object to the trace file.
    void blockFlow​(Flow flow)
    The event of a blocked flow is added to the trace file.
    java.lang.Object clone()
    Throws an exception to stop a cloned Tracer object from being created.
    void createLightpath​(LightPath lp)
    Registers, in the tracer file, that a lightpath was created.
    void deallocatedLightpath​(LightPath lp)
    Registers, in the tracer file, that a lightpath was removed.
    void finish()
    Finalizes the tracing actions by attributing the singletonObject to null and closing/flushing the object that generates the output.
    void flushTrace()  
    static Tracer getTracerObject()
    Creates a new Tracer object, in case it doesn't exist yet.
    void removeLightpath​(LightPath lp)
    Registers, in the tracer file, that a lightpath was removed.
    void rerouteFlow​(Flow flow, LightPath[] lightpaths, Path oldPath)
    The event of an accepted flow object is rerouted to the trace file.
    void setTraceFile​(java.lang.String filename)
    Prints formatted representations of a Tracer object to a text-output stream.
    void toogleTraceWriting​(boolean write)
    Toggles the writeTrace boolean between true or false.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getTracerObject

      public static Tracer getTracerObject()
      Creates a new Tracer object, in case it doesn't exist yet.
      Returns:
      the Tracer's singletonObject attribute
    • flushTrace

      public void flushTrace()
    • clone

      public java.lang.Object clone() throws java.lang.CloneNotSupportedException
      Throws an exception to stop a cloned Tracer object from being created.
      Overrides:
      clone in class java.lang.Object
      Throws:
      java.lang.CloneNotSupportedException
    • setTraceFile

      public void setTraceFile​(java.lang.String filename) throws java.io.IOException
      Prints formatted representations of a Tracer object to a text-output stream.
      Parameters:
      filename - name of the file where the output will go
      Throws:
      java.io.IOException - exception thrown in case something goes wrong
    • toogleTraceWriting

      public void toogleTraceWriting​(boolean write)
      Toggles the writeTrace boolean between true or false.
      Parameters:
      write - boolean that will be attributed to writeTrace
    • add

      public void add​(java.lang.Object o)
      Adds an object to the trace file. If it is an Event, the addEvent method will deal with it. Otherwise, the object is simply transformed into a String and printed into the trace file.
      Parameters:
      o - object to be added
    • acceptFlow

      public void acceptFlow​(Flow flow, LightPath[] lightpaths)
      The event of an accepted flow object is added to the trace file.
      Parameters:
      flow - the accepted flow
      lightpaths - the lightpaths that belong to the flow
    • blockFlow

      public void blockFlow​(Flow flow)
      The event of a blocked flow is added to the trace file.
      Parameters:
      flow - the blocked flow
    • rerouteFlow

      public void rerouteFlow​(Flow flow, LightPath[] lightpaths, Path oldPath)
      The event of an accepted flow object is rerouted to the trace file.
      Parameters:
      flow - the accepted flow
      lightpaths - the lightpaths that belong to the flow
    • createLightpath

      public void createLightpath​(LightPath lp)
      Registers, in the tracer file, that a lightpath was created.
      Parameters:
      lp - the LightPath object that was created
    • removeLightpath

      public void removeLightpath​(LightPath lp)
      Registers, in the tracer file, that a lightpath was removed.
      Parameters:
      lp - LightPath object that was removed
    • deallocatedLightpath

      public void deallocatedLightpath​(LightPath lp)
      Registers, in the tracer file, that a lightpath was removed.
      Parameters:
      lp - LightPath object that was removed
    • finish

      public void finish()
      Finalizes the tracing actions by attributing the singletonObject to null and closing/flushing the object that generates the output.