Class FlowObject<T extends Number & Comparable<T>>
java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.formalisms.flow.FlowObject<T>
- Type Parameters:
T
- the time type
- All Implemented Interfaces:
Serializable
,Remote
,Identifiable
,EventProducer
public abstract class FlowObject<T extends Number & Comparable<T>>
extends LocalEventProducer
implements Identifiable
A FlowObject that can receive and/or release Entity objects.
Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Peter Jacobs , Alexander Verbraeck
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final EventType
RECEIVE_EVENT is fired whenever an entity enters the flow object.static final EventType
RELEASE_EVENT is fired whenever an entity leaves the flow object.Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorDescriptionFlowObject
(String id, DevsSimulatorInterface<T> simulator) Construct a new FlowObject. -
Method Summary
Modifier and TypeMethodDescriptionReturn the current destination.getId()
Return the simulator.void
receiveEntity
(Entity<T> entity) Arrival of a new entity into the flow object.protected void
releaseEntity
(Entity<T> entity) Release an entity, making it flow to the next flow object (the destination) when destination is not null.void
setDestination
(FlowObject<T> destination) Set the destination of this flow object.toString()
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Field Details
-
RECEIVE_EVENT
RECEIVE_EVENT is fired whenever an entity enters the flow object. -
RELEASE_EVENT
RELEASE_EVENT is fired whenever an entity leaves the flow object.
-
-
Constructor Details
-
FlowObject
Construct a new FlowObject.- Parameters:
id
- String; the id of the FlowObjectsimulator
- DevsSimulatorInterface<T>; is the simulator on which behavior is scheduled
-
-
Method Details
-
receiveEntity
Arrival of a new entity into the flow object.- Parameters:
entity
- Entity; the arriving entity
-
setDestination
Set the destination of this flow object. The destination is the object the entity will go to when leaving this flow object.- Parameters:
destination
- FlowObject<T>; the next flow object in the model
-
releaseEntity
Release an entity, making it flow to the next flow object (the destination) when destination is not null. When destination is null, the entity will be discarded.- Parameters:
entity
- Entity; the entity to release
-
getDestination
Return the current destination.- Returns:
- FlowObject; the destination of this flow object
-
getSimulator
Return the simulator.- Returns:
- DevsSimultorInterface<T>; the simulator
-
getId
- Specified by:
getId
in interfaceIdentifiable
-
toString
-