Class ServicePoint

java.lang.Object
eds.framework.ServicePoint

public class ServicePoint extends Object
Represents a service point. A ServicePoint maintains a queue of simulation entities and processes them one at a time. Service times are generated using an exponential distribution (Negexp) by default. When service is completed, a new event is scheduled into the EventList.
  • Constructor Details

    • ServicePoint

      public ServicePoint(Negexp generator, EventList eventList, IEventType completionType)
      Creates a ServicePoint with an externally provided service time generator.
      Parameters:
      generator - service time generator
      eventList - reference to the event list
      completionType - event type triggered at service completion
    • ServicePoint

      public ServicePoint(double meanServiceTime, EventList eventList, IEventType completionType)
      Creates a ServicePoint using an exponential distribution with the given mean service time.
      Parameters:
      meanServiceTime - mean service time for Negexp distribution
      eventList - reference to the event list
      completionType - event type triggered at service completion
  • Method Details

    • add

      public void add(ISimulationEntity entity)
      Adds a simulation entity to the service queue.
      Parameters:
      entity - the entity to be added
    • finishService

      public ISimulationEntity finishService()
      Completes service for the current simulation entity.
      Returns:
      the entity that has finished service, or null if the queue was empty
    • isBusy

      public boolean isBusy()
      Returns whether the service point is currently busy.
      Returns:
      true if processing an entity, false otherwise
    • hasOrders

      public boolean hasOrders()
      Checks whether there are entities waiting in the queue.
      Returns:
      true if the queue is not empty
    • getQueueLength

      public int getQueueLength()
      Returns the current number of entities waiting in the queue. The entity currently in service (if any) is not counted as waiting.
      Returns:
      number of waiting entities
    • getQueueSize

      public int getQueueSize()
      Returns the current internal queue size, including the entity in service.
      Returns:
      total number of queued entities
    • startService

      public void startService()
      Starts service for the next entity in the queue. Generates a service completion event and schedules it in the EventList.