Class Seize<T extends Number & Comparable<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:
  • Field Details

    • QUEUE_LENGTH_EVENT

      public static final EventType QUEUE_LENGTH_EVENT
      QUEUE_LENGTH_EVENT is fired when the queue length is changed.
    • DELAY_TIME

      public static final EventType DELAY_TIME
      DELAY_TIME is fired when a new delayTime is computed.
  • Constructor Details

    • Seize

      public Seize(String id, DevsSimulatorInterface<T> simulator, Resource<T> resource)
      Constructor for Seize flow object.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; on which behavior is scheduled
      resource - 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 FlowObject
      simulator - DevsSimulatorInterface<T>; on which behavior is scheduled
      resource - Resource<T>; which is claimed
      requestedCapacity - double; is the amount which is claimed by the seize
  • Method Details

    • receiveObject

      public void receiveObject(Entity<T> entity, double pRequestedCapacity)
      Receive an object that requests an amount of units from a resource.
      Parameters:
      entity - Entity<T>; the object
      pRequestedCapacity - double; the requested capacity
    • receiveEntity

      public void receiveEntity(Entity<T> entity)
      Arrival of a new entity into the flow object.
      Overrides:
      receiveEntity in class FlowObject<T extends Number & Comparable<T>>
      Parameters:
      entity - Entity; the arriving entity
    • setQueue

      public void setQueue(List<Seize.Request<T>> queue)
      sets the queue to this seize. This enables seize blocks to share one queue.
      Parameters:
      queue - List<Request<T>>; is a new queue.
    • getQueue

      public List<Seize.Request<T>> getQueue()
      Return the queue.
      Returns:
      List<Request<T>>; the queue with requests to claim the resource
    • receiveRequestedResource

      public void receiveRequestedResource(double pRequestedCapacity, Resource<T> pResource)
      receive the requested resource.
      Specified by:
      receiveRequestedResource in interface ResourceRequestorInterface<T extends Number & Comparable<T>>
      Parameters:
      pRequestedCapacity - double; reflects the amount requested.
      pResource - Resource<T>; the requested resource.