java.lang.Object
edu.kit.ipd.sdq.pcm.simulation.scheduler.exact.queueing.runqueues.AbstractRunQueue
All Implemented Interfaces:
IRunQueue
Direct Known Subclasses:
ActiveExpiredRunQueue, SingleRunQueue

public abstract class AbstractRunQueue extends Object implements IRunQueue
  • Field Details

  • Constructor Details

    • AbstractRunQueue

      protected AbstractRunQueue()
  • Method Details

    • getCurrentLoad

      public int getCurrentLoad()
      Description copied from interface: IRunQueue
      Returns the current number of processes in the ready queues.
      Specified by:
      getCurrentLoad in interface IRunQueue
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IRunQueue
      Returns:
      True, if there are no processes in the runqueue.
    • removeProcess

      public boolean removeProcess(IActiveProcess process)
      Description copied from interface: IRunQueue
      Removes a process from the runqueue.
      Specified by:
      removeProcess in interface IRunQueue
      Returns:
      True, if the process was removed. False, if the process was not found in the queue.
    • contains

      public boolean contains(IActiveProcess process)
      Specified by:
      contains in interface IRunQueue
      Parameters:
      process - Process of interest.
      Returns:
      True, if the process is in this runqueue, otherwise false.
    • addProcess

      public void addProcess(IActiveProcess process, boolean inFront)
      Description copied from interface: IRunQueue
      Adds a process to the runqueue.
      Specified by:
      addProcess in interface IRunQueue
      inFront - If true, the process is added at the beginning of its queue, otherwise it is added at the queue's end.
    • containsRunning

      public boolean containsRunning(IActiveProcess process)
      Description copied from interface: IRunQueue
      Checks if the runqueue contains a running process.
      Specified by:
      containsRunning in interface IRunQueue
      Parameters:
      process - Process of interest.
      Returns:
      True, if the process is in the running list of the runqueue, otherwise false.
    • removeRunning

      public void removeRunning(IActiveProcess process)
      Description copied from interface: IRunQueue
      Removes a running process from the runqueue.
      Specified by:
      removeRunning in interface IRunQueue
      Parameters:
      process - Process of interest.
    • setRunningOn

      public void setRunningOn(IActiveProcess process, IResourceInstance instance)
      Description copied from interface: IRunQueue
      Sets the given process as running on the specified instance. Note that the process must not be marked as running on another instance.
      Specified by:
      setRunningOn in interface IRunQueue
      Parameters:
      process - Process to run.
      instance - Instance the process shall run on.
    • runningOn

      public IResourceInstance runningOn(IActiveProcess process)
      Specified by:
      runningOn in interface IRunQueue
      Parameters:
      process - Process of interest.
      Returns:
      The resource instance the given process is running on.
    • isIdle

      public boolean isIdle(IResourceInstance instance)
      Description copied from interface: IRunQueue
      True, if there is no process running on the given resource. Furthermore, the pending queue has to be empty if there is only one instance.
      Specified by:
      isIdle in interface IRunQueue
      Returns:
    • getNextRunnableProcess

      public abstract IActiveProcess getNextRunnableProcess(IResourceInstance instance)
      Description copied from interface: IRunQueue
      Returns the next process runnable on the given instance.
      Specified by:
      getNextRunnableProcess in interface IRunQueue
    • containsPending

      public abstract boolean containsPending(IActiveProcess process)
      Template Method. Returns
      Specified by:
      containsPending in interface IRunQueue
      Parameters:
      process -
      Returns:
    • numWaitingProcesses

      protected abstract int numWaitingProcesses()
      Template Method. Returns the number of processs waiting in the queue.
      Returns:
    • removePendingProcess

      public abstract boolean removePendingProcess(IActiveProcess process)
      Template method. Removes the given process from the queue.
      Specified by:
      removePendingProcess in interface IRunQueue
      Parameters:
      process -
      Returns:
      True, if the process was successfully removed, otherwise (if the process was not found) false.
    • addProcessToRunQueue

      protected abstract void addProcessToRunQueue(IActiveProcess process, boolean inFront)
      Template method.
      Parameters:
      process -
      inFront -