it.unimi.dsi.fastutil
Class IndirectPriorityQueues.EmptyIndirectPriorityQueue

java.lang.Object
  extended by it.unimi.dsi.fastutil.AbstractIndirectPriorityQueue
      extended by it.unimi.dsi.fastutil.IndirectPriorityQueues.EmptyIndirectPriorityQueue
All Implemented Interfaces:
IndirectPriorityQueue
Direct Known Subclasses:
IndirectDoublePriorityQueues.EmptyIndirectDoublePriorityQueue
Enclosing class:
IndirectPriorityQueues

public static class IndirectPriorityQueues.EmptyIndirectPriorityQueue
extends AbstractIndirectPriorityQueue

An immutable class representing the empty indirect priority queue.

This class may be useful to implement your own in case you subclass IndirectPriorityQueue.


Method Summary
 void allChanged()
          Notifies the queue that the all elements have changed (optional operation).
 void changed()
          Notifies the queue that the first element has changed (optional operation).
 void changed(int i)
          Notifies the queue that the specified element has changed (optional operation).
 void clear()
          Removes all elements from this queue.
 Comparator comparator()
          Returns the comparator associated with this queue, or null if it uses its elements' natural ordering.
 int dequeue()
          Dequeues the first element from the queue.
 void enqueue(int i)
          Enqueues a new element.
 int first()
          Returns the first element of the queue.
 int front(int[] a)
          Retrieves the front of the queue in a given array (optional operation).
 boolean isEmpty()
          Checks whether the queue is empty.
 int last()
          Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).
 void remove(int i)
          Removes the specified element from the queue (optional operation).
 int size()
          Returns the number of elements in this queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

enqueue

public void enqueue(int i)
Description copied from interface: IndirectPriorityQueue
Enqueues a new element.

Parameters:
i - the element to enqueue..

dequeue

public int dequeue()
Description copied from interface: IndirectPriorityQueue
Dequeues the first element from the queue.

Returns:
the dequeued element.

isEmpty

public boolean isEmpty()
Description copied from interface: IndirectPriorityQueue
Checks whether the queue is empty.

Specified by:
isEmpty in interface IndirectPriorityQueue
Overrides:
isEmpty in class AbstractIndirectPriorityQueue
Returns:
true if the queue is empty.

size

public int size()
Description copied from interface: IndirectPriorityQueue
Returns the number of elements in this queue.

Returns:
the number of elements in this queue.

clear

public void clear()
Description copied from interface: IndirectPriorityQueue
Removes all elements from this queue.


first

public int first()
Description copied from interface: IndirectPriorityQueue
Returns the first element of the queue.

Returns:
the first element.

last

public int last()
Description copied from interface: IndirectPriorityQueue
Returns the last element of the queue, that is, the element the would be dequeued last (optional operation).

Specified by:
last in interface IndirectPriorityQueue
Overrides:
last in class AbstractIndirectPriorityQueue
Returns:
the last element.

changed

public void changed()
Description copied from interface: IndirectPriorityQueue
Notifies the queue that the first element has changed (optional operation).

Specified by:
changed in interface IndirectPriorityQueue
Overrides:
changed in class AbstractIndirectPriorityQueue

allChanged

public void allChanged()
Description copied from interface: IndirectPriorityQueue
Notifies the queue that the all elements have changed (optional operation).

Specified by:
allChanged in interface IndirectPriorityQueue
Overrides:
allChanged in class AbstractIndirectPriorityQueue

comparator

public Comparator comparator()
Description copied from interface: IndirectPriorityQueue
Returns the comparator associated with this queue, or null if it uses its elements' natural ordering.

Returns:
the comparator associated with this sorted set, or null if it uses its elements' natural ordering.

changed

public void changed(int i)
Description copied from interface: IndirectPriorityQueue
Notifies the queue that the specified element has changed (optional operation).

Note that the specified element must belong to the queue.

Specified by:
changed in interface IndirectPriorityQueue
Overrides:
changed in class AbstractIndirectPriorityQueue
Parameters:
i - the element that has changed.

remove

public void remove(int i)
Description copied from interface: IndirectPriorityQueue
Removes the specified element from the queue (optional operation).

Note that the specified element must belong to the queue.

Specified by:
remove in interface IndirectPriorityQueue
Overrides:
remove in class AbstractIndirectPriorityQueue
Parameters:
i - the element to be removed.

front

public int front(int[] a)
Description copied from interface: IndirectPriorityQueue
Retrieves the front of the queue in a given array (optional operation).

The front of an indirect queue is the set of indices whose associated elements in the reference array are equal to the element associated to the first index. These indices can be always obtain by dequeueing, but this method should retrieve efficiently such indices in the given array without modifying the state of the queue.

Parameters:
a - an array large enough to hold the front (e.g., at least long as the reference array).
Returns:
the number of elements actually written (starting from the first position of a).