generator2
Class ObjectGenerator

java.lang.Object
  |
  +--generator2.ObjectGenerator
Direct Known Subclasses:
ConstantObjectGenerator

public class ObjectGenerator
extends java.lang.Object

Class for defining the properties of moving objects. An example is the computations of new starting and destination nodes.


Field Summary
protected static int currId
          The value of the next identifier.
protected  DataSpace dataspace
          The dataspace of the network.
protected  double maxLength
          The maximum length of routes.
protected  Node[] node
          The nodes of the network as an array.
protected  Nodes nodes
          The nodes of the network.
protected  int numOfGeneratedNodes
          The number of generated node pairs.
protected  int numOfObjAtBeginning
          Indicator for the number of moving objects at the beginning.
protected  int numOfObjPerTime
          Indicator for the number of moving objects per time.
protected  ObjectClasses objClasses
          The object classes.
protected  java.util.Properties properties
          Properties of the generator.
protected  java.util.Random random
          The random generator.
protected  Time time
          The time object.
protected  double totalLength
          The total length of routes.
 
Constructor Summary
ObjectGenerator(java.util.Properties properties, Time time, DataSpace ds, Nodes nodes, ObjectClasses objClasses, int numOfObjPerTime, int numOfObjAtBeginning)
          ObjectGenerator constructor.
 
Method Summary
 Node computeDestinationNode(int time, Node startingNode, int length, int objClass)
          Computes a new destination node of a route.
 int computeId(int currTime)
          Returns the identifier of the next new moving object.
 int computeLengthOfRoute(int time, int objClass)
          Generates the length of a new route.
 int computeObjectClass(int currTime)
          Computes the object class of a new object.
 Node computeStartingNode(int time, int objClass)
          Computes a new starting node.
 int getAverageRouteLength()
          Returns the average distance of routes.
 int numberOfNewObjects(int time)
          Returns the number of new objects at a time stamp.
 void reachDestination(MovingObject obj)
          Method, which is called, when a moving object reaches its destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currId

protected static int currId
The value of the next identifier.


properties

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


time

protected Time time
The time object.


dataspace

protected DataSpace dataspace
The dataspace of the network.


objClasses

protected ObjectClasses objClasses
The object classes.


nodes

protected Nodes nodes
The nodes of the network.


node

protected Node[] node
The nodes of the network as an array.


numOfObjPerTime

protected int numOfObjPerTime
Indicator for the number of moving objects per time.


numOfObjAtBeginning

protected int numOfObjAtBeginning
Indicator for the number of moving objects at the beginning.


maxLength

protected double maxLength
The maximum length of routes.


numOfGeneratedNodes

protected int numOfGeneratedNodes
The number of generated node pairs.


totalLength

protected double totalLength
The total length of routes.


random

protected java.util.Random random
The random generator.

Constructor Detail

ObjectGenerator

public ObjectGenerator(java.util.Properties properties,
                       Time time,
                       DataSpace ds,
                       Nodes nodes,
                       ObjectClasses objClasses,
                       int numOfObjPerTime,
                       int numOfObjAtBeginning)
ObjectGenerator constructor.

Parameters:
properties - properties of the generator
time - the time object
nodes - the nodes of the network
objClasses - description of the object classes
numOfObjPerTime - indicator for the number of objects per time
numOfObjAtBeginning - indicator for the number of moving objects at the beginning
Method Detail

computeDestinationNode

public Node computeDestinationNode(int time,
                                   Node startingNode,
                                   int length,
                                   int objClass)
Computes a new destination node of a route.

Parameters:
time - the time stamp
startingNode - the starting node of the route
length - preferred length of the route
objClass - the class of the object
Returns:
starting node

computeId

public int computeId(int currTime)
Returns the identifier of the next new moving object.

Parameters:
currTime - the current time
Returns:
the id

computeLengthOfRoute

public int computeLengthOfRoute(int time,
                                int objClass)
Generates the length of a new route.

Parameters:
time - time stamp
objClass - object class of the moving object
Returns:
length

computeObjectClass

public int computeObjectClass(int currTime)
Computes the object class of a new object.

Parameters:
currTime - the current time
Returns:
the class

computeStartingNode

public Node computeStartingNode(int time,
                                int objClass)
Computes a new starting node.

Parameters:
time - the time stamp
objClass - the class of the object
Returns:
starting node

getAverageRouteLength

public int getAverageRouteLength()
Returns the average distance of routes.

Returns:
the average distance of routes

numberOfNewObjects

public int numberOfNewObjects(int time)
Returns the number of new objects at a time stamp.

Parameters:
time - the time stamp
Returns:
number of objects

reachDestination

public void reachDestination(MovingObject obj)
Method, which is called, when a moving object reaches its destination. Can be used for infuencing the behavior of the methods computing the behavior of new objects.

Parameters:
obj - the moving object