nl.tudelft.simulation.dsol.formalisms.flow
Class Generator

java.lang.Object
  extended by nl.tudelft.simulation.event.EventProducer
      extended by nl.tudelft.simulation.dsol.formalisms.flow.Station
          extended by nl.tudelft.simulation.dsol.formalisms.flow.Generator
All Implemented Interfaces:
Serializable, StationInterface, EventProducerInterface
Direct Known Subclasses:
Schedule

public class Generator
extends Station

This class defines a generator
(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:21:26 $
Author:
Peter Jacobs , Alexander Verbraeck
See Also:
Serialized Form

Field Summary
protected  SerializableConstructor constructor
          constructor refers to the constructor to be invoked
protected  Object[] constructorArguments
          constructorArguments refer to the arguments invoked by the
static EventType CREATE_EVENT
          CREATE_EVENT is fired on creation
protected  DistContinuous interval
          interval defines the inter construction time
protected  SimEvent nextEvent
          nextEvent refers to the next simEvent
protected  DistContinuous startTime
          startTime defines the absolute startTime for the generator
 
Fields inherited from class nl.tudelft.simulation.dsol.formalisms.flow.Station
destination, simulator
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.dsol.formalisms.flow.StationInterface
RECEIVE_EVENT, RELEASE_EVENT
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
Generator(DEVSSimulatorInterface simulator, Class myClass, Object[] constructorArguments)
          constructs a new generator for objects in a simulation.
 
Method Summary
 void generate()
          generates a new entity with the basic constructorArguments
 void generate(Object[] constructorArguments)
          generates a new entity
 DistDiscrete getBatchSize()
          returns the batchSize
 DistContinuous getInterval()
          returns the interarrival intercal
 long getMaxNumber()
          returns the maximum number of entities to be created
 DistContinuous getStartTime()
          returns the startTime of the generator
 void receiveObject(Object object)
          receives an object is invoked whenever an entity arrives
 void setBatchSize(DistDiscrete batchSize)
          sets the batchsize of the generator
 void setInterval(DistContinuous interval)
          sets the interarrival distribution
 void setMaxNumber(long maxNumber)
          sets the maximum number of entities to be created
 void setStartTime(DistContinuous startTime)
          sets the startTime
 
Methods inherited from class nl.tudelft.simulation.dsol.formalisms.flow.Station
getDestination, releaseObject, setDestination
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypes, removeListener
 

Field Detail

CREATE_EVENT

public static final EventType CREATE_EVENT
CREATE_EVENT is fired on creation


constructorArguments

protected Object[] constructorArguments
constructorArguments refer to the arguments invoked by the


interval

protected DistContinuous interval
interval defines the inter construction time


startTime

protected DistContinuous startTime
startTime defines the absolute startTime for the generator


constructor

protected SerializableConstructor constructor
constructor refers to the constructor to be invoked


nextEvent

protected SimEvent nextEvent
nextEvent refers to the next simEvent

Constructor Detail

Generator

public Generator(DEVSSimulatorInterface simulator,
                 Class myClass,
                 Object[] constructorArguments)
          throws SimRuntimeException
constructs a new generator for objects in a simulation. Constructed objects are sent to the 'destination' of the Generator when a destination has been indicated with the setDestination method. This constructor has a maximum number of entities generated, which results in stopping the generator when the maximum number of entities has been reached.

Parameters:
simulator - is the on which the construction of the objects must be scheduled.
myClass - is the class of which entities are created
constructorArguments - are the parameters for the constructor of myClass. of arguments. constructorArgument[n]=new Integer(12) may have constructorArgumentClasses[n]=int.class;
Throws:
SimRuntimeException - on constructor invokation.
Method Detail

generate

public void generate()
              throws SimRuntimeException
generates a new entity with the basic constructorArguments

Throws:
SimRuntimeException - on construction failure

generate

public void generate(Object[] constructorArguments)
              throws SimRuntimeException
generates a new entity

Parameters:
constructorArguments - are the parameters used in the constructor.
Throws:
SimRuntimeException - on construction failure

receiveObject

public void receiveObject(Object object)
Description copied from interface: StationInterface
receives an object is invoked whenever an entity arrives

Specified by:
receiveObject in interface StationInterface
Overrides:
receiveObject in class Station
Parameters:
object - is the entity
See Also:
StationInterface.receiveObject(Object)

getBatchSize

public DistDiscrete getBatchSize()
returns the batchSize

Returns:
DistDiscrete

getInterval

public DistContinuous getInterval()
returns the interarrival intercal

Returns:
DistContinuous

getMaxNumber

public long getMaxNumber()
returns the maximum number of entities to be created

Returns:
long the maxNumber

setBatchSize

public void setBatchSize(DistDiscrete batchSize)
sets the batchsize of the generator

Parameters:
batchSize - is the number of entities simultaniously constructed

setInterval

public void setInterval(DistContinuous interval)
sets the interarrival distribution

Parameters:
interval - is the interarrival time

setMaxNumber

public void setMaxNumber(long maxNumber)
sets the maximum number of entities to be created

Parameters:
maxNumber - is the maxNumber

getStartTime

public DistContinuous getStartTime()
returns the startTime of the generator

Returns:
DistContinuous

setStartTime

public void setStartTime(DistContinuous startTime)
sets the startTime

Parameters:
startTime - is the absolute startTime


Copyright © 2002-2010 Delft University of Technology, the Netherlands. All Rights Reserved.