Class Seize<T extends Number & Comparable<T>>
java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.formalisms.flow.FlowObject<T>
nl.tudelft.simulation.dsol.formalisms.flow.Seize<T>
- Type Parameters:
T
- the time type
- All Implemented Interfaces:
Serializable
,Remote
,ResourceRequestorInterface<T>
,Identifiable
,EventProducer
public class Seize<T extends Number & Comparable<T>>
extends FlowObject<T>
implements ResourceRequestorInterface<T>
The Seize flow block requests a resource and keeps the entity within the flow block's queue until the resource is actually
claimed. Note that the Seize block has a queue in which the Entity is waiting, while the Resource has a queue in which the
request is waiting. This sounds like we store the same information twice. This is, however, not the case. (1) Multiple Seize
blocks can share the same Resource, each holding their own entities that make the request, where the total set of requests is
stored at the Resource. (2) A Seize could potentially request access to two resources, where the entity is held at the Seize
block until both are available. Each Resource keeps and grants its own requests. Since there nam be an n:m relationship
between Seize blocks and Resources, each have their own queue, with its own sorting mechanism (ideally the same).
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Seize.Request<T extends Number & Comparable<T>>
The Request Class defines the requests for resource. -
Field Summary
Modifier and TypeFieldDescriptionstatic final EventType
DELAY_TIME is fired when a new delayTime is computed.static final EventType
QUEUE_LENGTH_EVENT is fired when the queue length is changed.Fields inherited from class nl.tudelft.simulation.dsol.formalisms.flow.FlowObject
RECEIVE_EVENT, RELEASE_EVENT
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetQueue()
Return the queue.void
receiveEntity
(Entity<T> entity) Arrival of a new entity into the flow object.void
receiveObject
(Entity<T> entity, double pRequestedCapacity) Receive an object that requests an amount of units from a resource.void
receiveRequestedResource
(double pRequestedCapacity, Resource<T> pResource) receive the requested resource.void
setQueue
(List<Seize.Request<T>> queue) sets the queue to this seize.Methods inherited from class nl.tudelft.simulation.dsol.formalisms.flow.FlowObject
getDestination, getId, getSimulator, releaseEntity, setDestination, 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
-
QUEUE_LENGTH_EVENT
QUEUE_LENGTH_EVENT is fired when the queue length is changed. -
DELAY_TIME
DELAY_TIME is fired when a new delayTime is computed.
-
-
Constructor Details
-
Seize
Constructor for Seize flow object.- Parameters:
id
- String; the id of the FlowObjectsimulator
- DevsSimulatorInterface<T>; on which behavior is scheduledresource
- Resource<T>; which is claimed
-
Seize
public Seize(String id, DevsSimulatorInterface<T> simulator, Resource<T> resource, double requestedCapacity) Constructor for Seize flow object.- Parameters:
id
- String; the id of the FlowObjectsimulator
- DevsSimulatorInterface<T>; on which behavior is scheduledresource
- Resource<T>; which is claimedrequestedCapacity
- double; is the amount which is claimed by the seize
-
-
Method Details
-
receiveObject
Receive an object that requests an amount of units from a resource.- Parameters:
entity
- Entity<T>; the objectpRequestedCapacity
- double; the requested capacity
-
receiveEntity
Arrival of a new entity into the flow object.- Overrides:
receiveEntity
in classFlowObject<T extends Number & Comparable<T>>
- Parameters:
entity
- Entity; the arriving entity
-
setQueue
sets the queue to this seize. This enables seize blocks to share one queue.- Parameters:
queue
- List<Request<T>>; is a new queue.
-
getQueue
Return the queue.- Returns:
- List<Request<T>>; the queue with requests to claim the resource
-
receiveRequestedResource
receive the requested resource.- Specified by:
receiveRequestedResource
in interfaceResourceRequestorInterface<T extends Number & Comparable<T>>
- Parameters:
pRequestedCapacity
- double; reflects the amount requested.pResource
- Resource<T>; the requested resource.
-