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.
-
Method Details
-
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.CloneNotSupportedExceptionThrows an exception to stop a cloned Tracer object from being created.- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
setTraceFile
public void setTraceFile(java.lang.String filename) throws java.io.IOExceptionPrints 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
The event of an accepted flow object is added to the trace file.- Parameters:
flow
- the accepted flowlightpaths
- the lightpaths that belong to the flow
-
blockFlow
The event of a blocked flow is added to the trace file.- Parameters:
flow
- the blocked flow
-
rerouteFlow
The event of an accepted flow object is rerouted to the trace file.- Parameters:
flow
- the accepted flowlightpaths
- the lightpaths that belong to the flow
-
createLightpath
Registers, in the tracer file, that a lightpath was created.- Parameters:
lp
- the LightPath object that was created
-
removeLightpath
Registers, in the tracer file, that a lightpath was removed.- Parameters:
lp
- LightPath object that was removed
-
deallocatedLightpath
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.
-