Package jsl.modeling.elements.entity
Class EntityReceiver
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.simulation.SchedulingElement
-
- jsl.modeling.elements.entity.EntityReceiver
-
- All Implemented Interfaces:
GetEntityReceiverIfc,ObservableIfc,GetNameIfc,IdentityIfc
- Direct Known Subclasses:
AssignAttributes,CompositeEntityReceiver,CompositeEntityReceiver.Exit,Delay,NWayByChanceEntitySender,ReleaseResources,SeizeResources,SQSRWorkStation,TestEntityPackage.TestReceiver,TwoWayByChanceEntitySender,WorkStation
public abstract class EntityReceiver extends SchedulingElement implements GetEntityReceiverIfc
Represents a base class for developing model elements that can receive entities.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsl.simulation.ModelElement
ModelElement.EventBuilderIfc<T>, ModelElement.EventScheduler<T>, ModelElement.ModelElementComparator, ModelElement.RequestBuilder, ModelElement.RequestDurationIfc, ModelElement.RequestTimeIfc, ModelElement.RequestUsingIfc, ModelElement.TimedUpdateEventAction, ModelElement.TimeUnitIfc<T>, ModelElement.WarmUpEventAction
-
-
Field Summary
Fields Modifier and Type Field Description protected EntityReceivermyCompositeIf the EntityReceiver is part of a CompositeReceiver this attribute contains the reference to the compositeprotected EntityReceiverAbstractmyDirectEntityReceiverThis can be used to directly specify the next receiverprotected TimeWeightedmyNumInReceiverUsed to collect number of entities at the receiverprotected EntitySenderIfcmySenderUsed if the sending option isprotected EntityType.SendOptionmySendOptionThe option used by the receiver for sending entities.protected ResponseVariablemyTimeInReceiverUsed to collect time spent at receiver-
Fields inherited from class jsl.simulation.ModelElement
AFTER_EXPERIMENT, AFTER_REPLICATION, BEFORE_EXPERIMENT, BEFORE_REPLICATION, CONDITIONAL_ACTION_REGISTRATION, DEFAULT_TIMED_EVENT_PRIORITY, INITIALIZED, MONTE_CARLO, myAfterExperimentOption, myAfterReplicationOption, myBeforeExperimentOption, myBeforeReplicationOption, myInitializationOption, myLengthOfWarmUp, myModelElements, myMonteCarloOption, myObservableComponent, myReplicationEndedOption, myTimedUpdateActionListener, myTimedUpdateEvent, myTimedUpdateInterval, myTimedUpdateOption, myTimedUpdatePriority, myWarmUpActionListener, myWarmUpEvent, myWarmUpIndicator, myWarmUpOption, myWarmUpPriority, NONE, REMOVED_FROM_MODEL, REPLICATION_ENDED, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIMED_UPDATE, UPDATE, WARMUP
-
-
Constructor Summary
Constructors Constructor Description EntityReceiver(ModelElement parent)EntityReceiver(ModelElement parent, java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected EntityReceivergetComposite()EntityReceiverAbstractgetDirectEntityReceiver()An object that will directly receive the entityEntityReceiverAbstractgetEntityReceiver()Returns a reference to the underlying EntityReceiverAbstractbooleanisPartOfComposite()protected abstract voidreceive(Entity entity)Represents logic to correctly receive the entity and process it accordinglyprotected voidsendEntity(Entity e)Can be used by sub-classes to send the entity to its next receiver according to one of the specified options.protected voidsetComposite(EntityReceiver composite)voidsetDirectEntityReceiver(EntityReceiverAbstract receiver)Can be used to supply a direct receiver.voidsetDirectEntityReceiver(GetEntityReceiverIfc g)See setDirectEntityReceiver()voidsetEntitySender(EntitySenderIfc sender)Supply a sender to be used to send the entity If null is supplied the option is set to SendOption.NONEvoidsetSendingOption(EntityType.SendOption option)Sets the sending option SendOption {DIRECT, SEQ, BY_TYPE} DIRECT, client must use setDirectEntityReceiver() to set receiver SEQ, entity uses predefined sequence in its EntityType BY_TYPE, entity uses its EntityType to determine next receivervoidturnOnNumberInReceiverCollection()Causes the receiver to collect the number of entity's at the receiver.voidturnOnTimeInReceiverCollection()Causes the receiver to collect the time spent at the receiver.-
Methods inherited from class jsl.simulation.SchedulingElement
cancelEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, rescheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent, scheduleEvent
-
Methods inherited from class jsl.simulation.ModelElement
addObserver, addObserverToModelElements, afterExperiment, afterExperiment_, afterReplication, afterReplication_, asString, beforeExperiment, beforeExperiment_, beforeReplication, beforeReplication_, buildEventGenerator, cancelTimedUpdateEvent, cancelWarmUpEvent, changeParentModelElement, checkForAfterExperiment, checkForAfterReplication, checkForBeforeExperiment, checkForBeforeReplication, checkForConditionalActionRegistration, checkForInitialize, checkForMonteCarlo, checkForRemoveFromModel, checkForReplicationEnded, checkForTimedUpdate, checkForUpdate, checkForWarmUp, checkObserverState, checkWarmUpOption, clearModelElementObservers, contains, countObservers, createEntity, createEntity, createQObject, day, deleteObserver, deleteObserverFromModelElements, deleteObservers, findModelElementWithWarmUpEvent, getAfterExperimentOption, getAfterReplicationOption, getAllCounters, getAllModelElements, getAllRandomElements, getAllResponseVariables, getAllVariables, getBeforeExperimentOption, getBeforeReplicationOption, getChildModelElementIterator, getCurrentReplicationNumber, getDefaultEntityType, getExecutive, getExperiment, getId, getInitializationOption, getInitializationOrderAsString, getLeftPreOrderTraversalCount, getLengthOfWarmUp, getModel, getModelElementCompartor, getModelElementsAsString, getModelElementsAsString, getModelElementsAsString, getMonteCarloOption, getName, getNumberOfModelElements, getObserverState, getParentModelElement, getPreviousObserverState, getReplicationEndedOption, getRightPreOrderTraversalCount, getSimulation, getSpatialModel, getStringLabel, getThisElementsCounters, getThisElementsModelElements, getThisElementsRandomVariables, getThisElementsResponseVariables, getThisElementsVariables, getTime, getTimedUpdateInterval, getTimedUpdateOption, getUpdateNotificationFlag, getVariable, getWarmUpEventTime, getWarmUpOption, hour, indent, initialize, initialize_, isTimedUpdateEventScheduled, isWarmedUp, isWarmUpEventScheduled, isWarmUpScheduled, millisecond, minute, montecarlo, montecarlo_, notifyAfterExperimentObservers, notifyAfterReplicationObservers, notifyBeforeExperimentObservers, notifyBeforeReplicationObservers, notifyConditionalActionRegistrationObservers, notifyInitializationObservers, notifyMonteCarloObservers, notifyObservers, notifyObservers, notifyRemovingFromModelObservers, notifyReplicationEndedObservers, notifyTimedUpdateObservers, notifyUpdateObservers, notifyWarmUpObservers, registerConditionalActions, registerConditionalActions_, removedFromModel, removeFromModel, replicationEnded, replicationEnded_, schedule, second, seize, setAfterExperimentOption, setAfterExperimentOptionForModelElements, setAfterReplicationOption, setAfterReplicationOptionForModelElements, setBeforeExperimentOption, setBeforeExperimentOptionForModelElements, setBeforeReplicationOption, setBeforeReplicationOptionForModelElements, setInitializationOption, setInitializationOptionForModelElements, setLengthOfWarmUp, setModel, setMonteCarloOption, setMonteCarloOptionForModelElements, setName, setObserverState, setParentModelElement, setReplicationEndedOption, setReplicationEndedOptionForModelElements, setSpatialModel, setStringLabel, setTimedUpdateInterval, setTimedUpdateOption, setTimedUpdateOptionForModelElements, setUpdateNotificationFlag, setWarmUpOption, setWarmUpOptionForModelElements, stopExecutive, stopExecutive, timedUpdate, timedUpdate_, toString, update, useControls, warmUp, warmUp_, week
-
-
-
-
Field Detail
-
mySendOption
protected EntityType.SendOption mySendOption
The option used by the receiver for sending entities.
-
myTimeInReceiver
protected ResponseVariable myTimeInReceiver
Used to collect time spent at receiver
-
myNumInReceiver
protected TimeWeighted myNumInReceiver
Used to collect number of entities at the receiver
-
myDirectEntityReceiver
protected EntityReceiverAbstract myDirectEntityReceiver
This can be used to directly specify the next receiver
-
myComposite
protected EntityReceiver myComposite
If the EntityReceiver is part of a CompositeReceiver this attribute contains the reference to the composite
-
mySender
protected EntitySenderIfc mySender
Used if the sending option is
-
-
Constructor Detail
-
EntityReceiver
public EntityReceiver(ModelElement parent)
-
EntityReceiver
public EntityReceiver(ModelElement parent, java.lang.String name)
-
-
Method Detail
-
turnOnTimeInReceiverCollection
public final void turnOnTimeInReceiverCollection()
Causes the receiver to collect the time spent at the receiver. This must be called prior to any replications
-
turnOnNumberInReceiverCollection
public final void turnOnNumberInReceiverCollection()
Causes the receiver to collect the number of entity's at the receiver. This must be called prior to any replications
-
setComposite
protected void setComposite(EntityReceiver composite)
-
getComposite
protected EntityReceiver getComposite()
-
isPartOfComposite
public boolean isPartOfComposite()
-
receive
protected abstract void receive(Entity entity)
Represents logic to correctly receive the entity and process it accordingly- Parameters:
entity-
-
getEntityReceiver
public final EntityReceiverAbstract getEntityReceiver()
Returns a reference to the underlying EntityReceiverAbstract- Specified by:
getEntityReceiverin interfaceGetEntityReceiverIfc- Returns:
-
sendEntity
protected void sendEntity(Entity e)
Can be used by sub-classes to send the entity to its next receiver according to one of the specified options.- Parameters:
e-
-
setEntitySender
public final void setEntitySender(EntitySenderIfc sender)
Supply a sender to be used to send the entity If null is supplied the option is set to SendOption.NONE- Parameters:
sender-
-
setSendingOption
public final void setSendingOption(EntityType.SendOption option)
Sets the sending option SendOption {DIRECT, SEQ, BY_TYPE} DIRECT, client must use setDirectEntityReceiver() to set receiver SEQ, entity uses predefined sequence in its EntityType BY_TYPE, entity uses its EntityType to determine next receiver- Parameters:
option-
-
getDirectEntityReceiver
public final EntityReceiverAbstract getDirectEntityReceiver()
An object that will directly receive the entity- Returns:
-
setDirectEntityReceiver
public final void setDirectEntityReceiver(EntityReceiverAbstract receiver)
Can be used to supply a direct receiver. If used the sending option is automatically changed to direct- Parameters:
receiver-
-
setDirectEntityReceiver
public final void setDirectEntityReceiver(GetEntityReceiverIfc g)
See setDirectEntityReceiver()- Parameters:
g-
-
-