generator2
Class Reporter

java.lang.Object
  |
  +--generator2.Reporter
Direct Known Subclasses:
NodeReporter, OracleReporter, PositionReporter

public class Reporter
extends java.lang.Object

Abstract class for reporting the computed moving objects. Non-abstract subclasses are generator2.DefaultReporter and generator2.OracleReporter.


Field Summary
static byte DEL_OBJECT
          Action code "disappering object".
static byte MOVE_OBJECT
          Action code "moving object".
static byte NEW_OBJECT
          Action code "new object".
protected  int numOfEdges
          Number of reported edges.
protected  int numOfPoints
          Number of reported points.
protected  DrawableObjects objects
          Container of drawable objects.
protected  java.util.Properties properties
          Properties of the generator.
protected  java.util.Random random
          The random generator.
protected static int SYMBOLLAYER
          Layer of the drawable objects.
protected  boolean visualize
          Should the objects be visualized?
static java.lang.String VIZ
          Name of property indicating a visualization.
 
Constructor Summary
Reporter(java.util.Properties properties, DrawableObjects objects)
          Reporter constructor.
 
Method Summary
 void close()
          Does nothing.
 int getNumberOfReportedEdges()
          Returns the number of reported edges.
 int getNumberOfReportedPoints()
          Returns the number of reported points.
 void removeReportedObjects()
          Removes the reported moving objects.
 void reportDisappearingExternalObject(int time, long id, int repNum, int objClass, java.awt.Rectangle rect)
          Does nothing.
 void reportDisappearingObject(double time, long id, int repNum, int objClass, int x, int y, double doneDist, int reportProbability)
          Does nothing.
 void reportDouble(java.lang.String text, double value)
          Reports a double with an explaining text on the standard output.
 void reportEdge(double time, long objId, int edgeRepNum, int objClass, long edgeId, int edgeClass, int x1, int y1, double speed, int x2, int y2, int reportProbability)
          Does nothing.
 void reportInt(java.lang.String text, long value)
          Reports an integer number with an explaining text on the stardard output.
 void reportMovingExternalObject(int time, long id, int repNum, int objClass, java.awt.Rectangle rect)
          Reports a moving external object.
 int reportMovingObject(int time, long id, int repNum, int objClass, double x, double y, double speed, double doneDist, int nextNodeX, int nextNodeY, int reportProbability)
          Reports the characteristic properties of a moving object at a time stamp according to its report probability.
 void reportNewExternalObject(int time, long id, int objClass, java.awt.Rectangle rect)
          Reports a new external object.
 int reportNewMovingObject(int time, long id, int objClass, int x, int y, double speed, int nextNodeX, int nextNodeY, int reportProbability)
          Reports an new moving object if its report probability > 0.
protected  void visualizeExternalObject(java.awt.Rectangle rect, int objClass, int time)
          Visualizes an external object.
protected  void visualizeMovingObject(int x, int y, int objClass, int time)
          Visualizes a moving object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEW_OBJECT

public static final byte NEW_OBJECT
Action code "new object".

See Also:
Constant Field Values

MOVE_OBJECT

public static final byte MOVE_OBJECT
Action code "moving object".

See Also:
Constant Field Values

DEL_OBJECT

public static final byte DEL_OBJECT
Action code "disappering object".

See Also:
Constant Field Values

properties

protected java.util.Properties properties
Properties of the generator.


visualize

protected boolean visualize
Should the objects be visualized?


VIZ

public static final java.lang.String VIZ
Name of property indicating a visualization.

See Also:
Constant Field Values

SYMBOLLAYER

protected static final int SYMBOLLAYER
Layer of the drawable objects.

See Also:
Constant Field Values

objects

protected DrawableObjects objects
Container of drawable objects.


numOfPoints

protected int numOfPoints
Number of reported points.


numOfEdges

protected int numOfEdges
Number of reported edges.


random

protected java.util.Random random
The random generator.

Constructor Detail

Reporter

public Reporter(java.util.Properties properties,
                DrawableObjects objects)
Reporter constructor. Must be called by constructors of subclasses.

Parameters:
properties - properties of the generator
objects - container of drawable objects
Method Detail

close

public void close()
Does nothing. Can be overwritten for closing the reporter.


getNumberOfReportedEdges

public int getNumberOfReportedEdges()
Returns the number of reported edges.

Returns:
number of reported edges

getNumberOfReportedPoints

public int getNumberOfReportedPoints()
Returns the number of reported points.

Returns:
number of reported points

removeReportedObjects

public void removeReportedObjects()
Removes the reported moving objects.


reportDisappearingExternalObject

public void reportDisappearingExternalObject(int time,
                                             long id,
                                             int repNum,
                                             int objClass,
                                             java.awt.Rectangle rect)
Does nothing. Can be overwritten for reporting a disappearing external object.

Parameters:
time - time stamp
id - object id
repNum - report number
objClass - object class
rect - the area

reportDisappearingObject

public void reportDisappearingObject(double time,
                                     long id,
                                     int repNum,
                                     int objClass,
                                     int x,
                                     int y,
                                     double doneDist,
                                     int reportProbability)
Does nothing. Should be overwritten for reporting the characteristic properties of a dispappering object at a time stamp

Parameters:
time - the arrival time (with fraction)
id - object id
repNum - report number
objClass - object class
x - x-coordinate
y - y-coordinate
doneDist - the distance since the last reporting
reportProbability - value between (0..1000)

reportDouble

public void reportDouble(java.lang.String text,
                         double value)
Reports a double with an explaining text on the standard output.

Parameters:
text - explaining text
value - output value

reportEdge

public void reportEdge(double time,
                       long objId,
                       int edgeRepNum,
                       int objClass,
                       long edgeId,
                       int edgeClass,
                       int x1,
                       int y1,
                       double speed,
                       int x2,
                       int y2,
                       int reportProbability)
Does nothing. Can be overwritten for reporting the coordinates of a traversed edge if the report probability > 0.

Parameters:
time - time stamp (with fraction) when the edge is entried
objId - the id of the moving object id
edgeRepNum - the edge report number
objClass - object class
edgeId - the edge id
edgeClass - the edge class
x1 - the first (= current) x-coordinate
y1 - the first (= current) y-coordinate
speed - current speed
x2 - the second (= later) x-coordinate
y2 - the second (= later) y-coordinate
reportProbability - (0..1000)

reportInt

public void reportInt(java.lang.String text,
                      long value)
Reports an integer number with an explaining text on the stardard output.

Parameters:
text - explaining text
value - output value

reportMovingExternalObject

public void reportMovingExternalObject(int time,
                                       long id,
                                       int repNum,
                                       int objClass,
                                       java.awt.Rectangle rect)
Reports a moving external object.

Parameters:
time - time stamp
id - object id
repNum - report number
objClass - object class
rect - the area

reportMovingObject

public int reportMovingObject(int time,
                              long id,
                              int repNum,
                              int objClass,
                              double x,
                              double y,
                              double speed,
                              double doneDist,
                              int nextNodeX,
                              int nextNodeY,
                              int reportProbability)
Reports the characteristic properties of a moving object at a time stamp according to its report probability.

Parameters:
time - time stamp
id - object id
repNum - report number
objClass - object class
x - x-coordinate
y - y-coordinate
speed - current speed
doneDist - the distance since the last reporting
nextNodeX - x-coordinate of the next node
nextNodeY - y-coordinate of the next node
reportProbability - value between (0..1000)
Returns:
new report number

reportNewExternalObject

public void reportNewExternalObject(int time,
                                    long id,
                                    int objClass,
                                    java.awt.Rectangle rect)
Reports a new external object.

Parameters:
time - time stamp
id - object id
objClass - object class
rect - the area

reportNewMovingObject

public int reportNewMovingObject(int time,
                                 long id,
                                 int objClass,
                                 int x,
                                 int y,
                                 double speed,
                                 int nextNodeX,
                                 int nextNodeY,
                                 int reportProbability)
Reports an new moving object if its report probability > 0.

Parameters:
time - time stamp
id - object id
objClass - object class
x - x-coordinate of start
y - y-coordinate of start
speed - current speed
nextNodeX - x-coordinate of the next node
nextNodeY - y-coordinate of the next node
reportProbability - value between (0..1000)

visualizeExternalObject

protected void visualizeExternalObject(java.awt.Rectangle rect,
                                       int objClass,
                                       int time)
Visualizes an external object.

Parameters:
rect - the object as rectangle
objClass - object class
time - time stamp

visualizeMovingObject

protected void visualizeMovingObject(int x,
                                     int y,
                                     int objClass,
                                     int time)
Visualizes a moving object.

Parameters:
x - x
y - x
objClass - object class
time - time stamp