Class SingleQueueStation

  • All Implemented Interfaces:
    ReceiveQObjectIfc, ObservableIfc, GetNameIfc, IdentityIfc

    public class SingleQueueStation
    extends Station
    Models a service station with a resource that has a single queue to hold waiting customers. Customers can only use 1 unit of the resource while in service.
    • Constructor Detail

      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent)
        Uses a resource with capacity 1 and service time Constant.ZERO
        Parameters:
        parent -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  GetValueIfc sd)
        Uses a resource with capacity 1
        Parameters:
        parent -
        sd -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  java.lang.String name)
        Uses a resource with capacity 1 and service time Constant.ZERO
        Parameters:
        parent -
        name -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  GetValueIfc sd,
                                  java.lang.String name)
        Uses a resource with capacity 1
        Parameters:
        parent -
        sd -
        name -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  SResource resource)
        No sender is provided.
        Parameters:
        parent -
        resource -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  SResource resource,
                                  GetValueIfc sd)
        No sender is provided.
        Parameters:
        parent -
        resource -
        sd -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  SResource resource,
                                  GetValueIfc sd,
                                  java.lang.String name)
        No sender is provided.
        Parameters:
        parent -
        resource -
        sd -
        name -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  GetValueIfc sd,
                                  SendQObjectIfc sender,
                                  java.lang.String name)
        Default resource of capacity 1 is used
        Parameters:
        parent -
        sd -
        sender -
        name -
      • SingleQueueStation

        public SingleQueueStation​(ModelElement parent,
                                  SResource resource,
                                  GetValueIfc sd,
                                  SendQObjectIfc sender,
                                  java.lang.String name)
        Parameters:
        parent -
        resource -
        sd - Represents the time using the resource
        sender - handles sending to next
        name -
    • Method Detail

      • initialize

        protected void initialize()
        Description copied from class: ModelElement
        This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called
        Overrides:
        initialize in class ModelElement
      • getServiceTime

        protected double getServiceTime​(QObject customer)
      • serveNext

        protected void serveNext()
        Called to determine which waiting QObject will be served next Determines the next customer, seizes the resource, and schedules the end of the service.
      • receive

        public void receive​(QObject customer)
      • setUseQObjectServiceTimeOption

        public final void setUseQObjectServiceTimeOption​(boolean option)
        Tells the station to use the QObject to determine the service time
        Parameters:
        option - true means the station uses the QObject's getValueObject() to determine the service time
      • getUseQObjectServiceTimeOption

        public final boolean getUseQObjectServiceTimeOption()
        Whether or not the station uses the QObject to determine the service time
        Returns:
        true means the station uses the QObject's getValueObject() to determine the service time
      • getNumberInQueue

        public final int getNumberInQueue()
        The current number in the queue
        Returns:
        The current number in the queue
      • getNumberInStation

        public final int getNumberInStation()
        The current number in the station (in queue + in service)
        Returns:
        current number in the station (in queue + in service)
      • getInitialResourceCapacity

        public final int getInitialResourceCapacity()
        The initial capacity of the resource at the station
        Returns:
        initial capacity of the resource at the station
      • setInitialCapacity

        public final void setInitialCapacity​(int capacity)
        Sets the initial capacity of the station's resource
        Parameters:
        capacity - the initial capacity of the station's resource
      • setServiceTime

        public final void setServiceTime​(GetValueIfc st)
        If the service time is null, it is assumed to be zero
        Parameters:
        st - the GetValueIfc implementor that provides the service time
      • getServiceTime

        public final GetValueIfc getServiceTime()
        The object used to determine the service time when not using the QObject option
        Returns:
        the object used to determine the service time when not using the QObject
      • getNBAcrossReplicationStatistic

        public final StatisticAccessorIfc getNBAcrossReplicationStatistic()
        Across replication statistics on the number busy servers
        Returns:
        Across replication statistics on the number busy servers
      • getNSAcrossReplicationStatistic

        public final StatisticAccessorIfc getNSAcrossReplicationStatistic()
        Across replication statistics on the number in system
        Returns:
        Across replication statistics on the number in system
      • getNSWithinReplicationStatistic

        public final WeightedStatisticIfc getNSWithinReplicationStatistic()
        Within replication statistics on the number in system
        Returns:
        Within replication statistics on the number in system
      • isResourceAvailable

        public final boolean isResourceAvailable()
        Returns:
        true if a resource has available units
      • getCapacity

        public final int getCapacity()
        The capacity of the resource. Maximum number of units that can be busy.
        Returns:
        The capacity of the resource. Maximum number of units that can be busy.
      • getNumBusyServers

        public final int getNumBusyServers()
        Current number of busy servers
        Returns:
        Current number of busy servers
      • getFractionBusy

        public final double getFractionBusy()
        Fraction of the capacity that is busy.
        Returns:
        Fraction of the capacity that is busy.
      • isQueueEmpty

        public final boolean isQueueEmpty()
        Whether the queue is empty
        Returns:
        Whether the queue is empty
      • isQueueNotEmpty

        public final boolean isQueueNotEmpty()
        Whether the queue is not empty
        Returns:
        Whether the queue is not empty
      • addQueueListener

        public final boolean addQueueListener​(QueueListenerIfc<QObject> listener)
        Adds a QueueListenerIfc to the underlying queue
        Parameters:
        listener - the listener to queue state changes
        Returns:
        true if added
      • removeQueueListener

        public boolean removeQueueListener​(QueueListenerIfc<QObject> listener)
        Removes a QueueListenerIfc from the underlying queue
        Parameters:
        listener - the listener to queue state changes
        Returns:
        true if removed
      • changeDiscipline

        public final void changeDiscipline​(Queue.Discipline discipline)
        Parameters:
        discipline - the new discipline
      • getInitialDiscipline

        public final Queue.Discipline getInitialDiscipline()
        Returns:
        the initial queue discipline
      • setInitialDiscipline

        public final void setInitialDiscipline​(Queue.Discipline discipline)
        Parameters:
        discipline - the initial queue discipline