Module xl.impl

Class QueueCollection

java.lang.Object
de.grogra.xl.impl.queues.QueueCollection

public final class QueueCollection extends Object
A QueueCollection represents a set of Queues in the context of a Graph. For the base implementation of the XL interfaces, it is obtained at run-time by the invocation of Graph.getQueues().

Queues are added to this collection by invocation of getQueue(QueueDescriptor).

Author:
Ole Kniemeyer
  • Constructor Details

    • QueueCollection

      public QueueCollection(Graph graph)
  • Method Details

    • getGraph

      public Graph getGraph()
      Returns:
      the Graph of this queue collection
    • getModel

      public RuntimeModel getModel()
      Returns:
      the RuntimeModel of the graph of this queue collection
    • clear

      public void clear()
      Clears all queues of this collection.
    • process

      public boolean process(int[] segments) throws RuntimeModelException
      Processes the queues of this collection by invoking Queue.process(int[]) for every queue. All queues which have been registered by getQueue(QueueDescriptor) are processed. The order of processing is defined by the QueueDescriptors of the queues: If q and r are two queues having descriptors Q and R, then q.process(segments) may be invoked before r.process(segments) only if Q is not contained in R.queuesToProcessAfter() and R is not contained in Q.queuesToProcessBefore(). After all queues have been processed, this method clears the queues.
      Returns:
      true iff at least one invocation of the process method on a queue has returned true.
      Throws:
      RuntimeModelException - if the processing of a queue throws such an exception, or if there is a circularity in the processing order
    • getQueues

      public void getQueues(List<Queue> list)
    • getQueue

      public <Q extends Queue> Q getQueue(QueueDescriptor<Q> descr)
      Registers and returns a queue for the given descriptor. If this method has been invoked before with the same descriptor, the previously returned queue is returned again. Otherwise, a new queue is created by the invocation of QueueDescriptor.createQueue(QueueCollection) on descr, registered with this queue collection, and returned.
      Parameters:
      descr - the descriptor of the queue
      Returns:
      a queue corresponding to the descriptor
    • addQueue

      public void addQueue(Queue queue)
    • startNewSegment

      public int startNewSegment()
    • resetToSegment

      public void resetToSegment(int n)