generator2
Class ConstantObjectGenerator

java.lang.Object
  |
  +--generator2.ObjectGenerator
        |
        +--generator2.ConstantObjectGenerator

public class ConstantObjectGenerator
extends ObjectGenerator

Example for an object generator garanteeing a constant number of moving objects during all time stamps.


Field Summary
protected  java.util.Stack deadObjs
          Container of dead objects.
 
Fields inherited from class generator2.ObjectGenerator
currId, dataspace, maxLength, node, nodes, numOfGeneratedNodes, numOfObjAtBeginning, numOfObjPerTime, objClasses, properties, random, time, totalLength
 
Constructor Summary
ConstantObjectGenerator(java.util.Properties properties, Time time, DataSpace ds, Nodes nodes, ObjectClasses objClasses, int numOfObjPerTime, int numOfObjAtBeginning)
          ConstantObjectGenerator 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 computeObjectClass(int currTime)
          Computes the object class of a new object.
 Node computeStartingNode(int time, int objClass)
          Computes a new starting node.
 int numberOfNewObjects(int time)
          Returns the number of new objects at a time stamp.
 void reachDestination(MovingObject obj)
          Stores the object for using its properties for new objects.
 
Methods inherited from class generator2.ObjectGenerator
computeLengthOfRoute, getAverageRouteLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

deadObjs

protected java.util.Stack deadObjs
Container of dead objects.

Constructor Detail

ConstantObjectGenerator

public ConstantObjectGenerator(java.util.Properties properties,
                               Time time,
                               DataSpace ds,
                               Nodes nodes,
                               ObjectClasses objClasses,
                               int numOfObjPerTime,
                               int numOfObjAtBeginning)
ConstantObjectGenerator 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.

Overrides:
computeDestinationNode in class ObjectGenerator
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.

Overrides:
computeId in class ObjectGenerator
Parameters:
currTime - the current time
Returns:
the id

computeObjectClass

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

Overrides:
computeObjectClass in class ObjectGenerator
Parameters:
currTime - the current time
Returns:
the class

computeStartingNode

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

Overrides:
computeStartingNode in class ObjectGenerator
Parameters:
time - the time stamp
objClass - the class of the object
Returns:
starting node

numberOfNewObjects

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

Overrides:
numberOfNewObjects in class ObjectGenerator
Parameters:
time - the time stamp
Returns:
number of objects

reachDestination

public void reachDestination(MovingObject obj)
Stores the object for using its properties for new objects.

Overrides:
reachDestination in class ObjectGenerator
Parameters:
obj - the moving object