tigase.util

## Class PriorityQueueAbstract<E>

- java.lang.Object
- - tigase.util.PriorityQueueAbstract<E>

- Type Parameters:
    `E` -
  Direct Known Subclasses:
    NonpriorityQueue, PriorityQueueRelaxed, PriorityQueueStrict

      public abstract class PriorityQueueAbstract<E>
      extends Object

  Works like a LinkedBlockingQueue using the put() and take() methods but with an additional priority integer parameter. The elemnt returned from take() will honor the priority in such a way that all elements of a lower priority will be returned before any elemens of a higher priority. Modified proposition taken from Noa Resare: http://resare.com/noa/ref/MultiPrioQueue.java
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `NONPRIORITY_QUEUE` Field description
    `static String` | `QUEUE_IMPLEMENTATION` Field description

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PriorityQueueAbstract()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <E> PriorityQueueAbstract<E>` | `getPriorityQueue(int maxPriority, int maxSize)` Method description
    `abstract void` | `init(int maxPriority, int maxSize)` Method description
    `abstract boolean` | `offer(E element, int priority)` Method description
    `abstract void` | `put(E element, int priority)` Method description
    `abstract void` | `setMaxSize(int maxSize)` Method description
    `abstract int[]` | `size()` Method description
    `abstract E` | `take()` Method description
    `abstract int` | `totalSize()` Method description

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NONPRIORITY_QUEUE

          public static final String NONPRIORITY_QUEUE

      Field description
      See Also:
        Constant Field Values

    - #### QUEUE_IMPLEMENTATION

          public static final String QUEUE_IMPLEMENTATION

      Field description
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PriorityQueueAbstract

          public PriorityQueueAbstract()

  - ### Method Detail

    - #### init

          public abstract void init(int maxPriority,
                  int maxSize)

      Method description
      Parameters:
        `maxPriority` -
        `maxSize` -

    - #### offer

          public abstract boolean offer(E element,
                      int priority)

      Method description
      Parameters:
        `element` -
        `priority` -
      Returns:

    - #### put

          public abstract void put(E element,
                 int priority)
                            throws InterruptedException

      Method description
      Parameters:
        `element` -
        `priority` -
      Throws:
        `InterruptedException`

    - #### setMaxSize

          public abstract void setMaxSize(int maxSize)

      Method description
      Parameters:
        `maxSize` -

    - #### size

          public abstract int[] size()

      Method description
      Returns:

    - #### take

          public abstract E take()
                          throws InterruptedException

      Method description
      Returns:
      Throws:
        `InterruptedException`

    - #### totalSize

          public abstract int totalSize()

      Method description
      Returns:

    - #### getPriorityQueue

          public static <E> PriorityQueueAbstract<E> getPriorityQueue(int maxPriority,
                                                      int maxSize)

      Method description
      Type Parameters:
        `E` -
      Parameters:
        `maxPriority` -
        `maxSize` -
      Returns:

Copyright © 2013 Tigase. All rights reserved.