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

## umontreal.iro.lecuyer.contactcenters.app.trace
Class FileContactTrace

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.app.trace.FileContactTrace

All Implemented Interfaces:
  ContactTrace

    public class FileContactTrace

extends Object
implements ContactTrace

Defines an exited-contact listener used to output a trace of every call processed by a simulator into a text file. Each time a new contact is notified to this listener, a line is appended to a writer linked to a file. This results in a call-by-call trace of the simulation. If an I/O exception is thrown at any given time by the writer, the exception's stack trace is logged, and this call tracer is disabled to avoid getting any further exception message.

Field Summary

Fields inherited from interface umontreal.iro.lecuyer.contactcenters.app.trace.ContactTrace
`OUTCOME_ABANDONED, OUTCOME_BLOCKED, OUTCOME_FAILED, OUTCOME_SERVED`

Constructor Summary
`FileContactTrace(File traceFile, int timePrecision)` Constructs a new call trace sending the information to the text file `traceFile`.

Method Summary
`void` | `close()` Closes the trace facility after a simulation.
`static ContactTrace` | `create(CallTraceParams traceParams)` Creates a new contact trace facility from the given parameters.
`String` | `getHeader()` Returns a string containing the field names for this trace.
`static String` | `getHeader(int timePrecision)`
`void` | `init()` Initializes the tracing mechanism.
`void` | `writeHeader()` Writes the output of `getHeader()` in the trace file, followed by an end-line character.
`void` | `writeLine(int step, int type, int period, double arvTime, double queueTime, String outcome, int group, double srvTime)` Writes a new line in the trace representing a simulated contact.

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

Constructor Detail

### FileContactTrace

    public FileContactTrace(File traceFile,
                            int timePrecision)

  Constructs a new call trace sending the information to the text file `traceFile`.

  Parameters:
    `traceFile` - the output trace file.
    `timePrecision` - the number of digits for arrival, waiting, and service times.

Method Detail

### create

    public static ContactTrace create(CallTraceParams traceParams)

  Creates a new contact trace facility from the given parameters. The class of the returned object depends on the given parameters, which are usually read from an XML file.

  More specifically, if these parameters include information on a database connection, a `DBContactTrace` instance is returned. Otherwise, if the name of the output file of the trace ends with `.xls`, an `ExcelContactTrace` is returned. Otherwise, a `FileContactTrace` is returned.

  Parameters:
    `traceParams` - the parameters of the trace.
  Returns:
    the contact trace facility.

### init

    public void init()

  Description copied from interface: `ContactTrace`
  Initializes the tracing mechanism. This method opens the trace file or database connection, and writes headers, etc. If an error occurs during the initialization, this method should log the error, and disable tracing.

  Specified by:
    `init` in interface `ContactTrace`

### close

    public void close()

  Description copied from interface: `ContactTrace`
  Closes the trace facility after a simulation. This method closes files, database connections, etc.

  Specified by:
    `close` in interface `ContactTrace`

### getHeader

    public String getHeader()

  Returns a string containing the field names for this trace. This string can be written as an header at the beginning of trace files.

  Returns:
    the header string.

### getHeader

    public static String getHeader(int timePrecision)

### writeHeader

    public void writeHeader()

  Writes the output of `getHeader()` in the trace file, followed by an end-line character.

### writeLine

    public void writeLine(int step,
                          int type,
                          int period,
                          double arvTime,
                          double queueTime,
                          String outcome,
                          int group,
                          double srvTime)

  Description copied from interface: `ContactTrace`
  Writes a new line in the trace representing a simulated contact. The line includes the step of the simulation at which the contact occurred, the type of the contact, the period of its arrival, its time spent in queue, its outcome, the group of its serving agent, and its service time. Some of these fields might be `Double.NaN` if the information does not exist. For example, a blocked or abandoned call does not have a serving agent group, or a service time.

  Specified by:
    `writeLine` in interface `ContactTrace`
  Parameters:
    `step` - the step, in the experiment, during which the call occurred.
    `type` - the type of the call.
    `period` - the period of arrival of the call.
    `arvTime` - the arrival time.
    `queueTime` - the time spent by the call in the queue.
    `outcome` - the outcome of the call.
    `group` - the group of the serving agent.
    `srvTime` - the service time of the call.

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

To submit a bug or ask questions, send an e-mail to Richard Simard.