com.rapidminer.tools.math.container
Class BoundedPriorityQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by java.util.PriorityQueue<E>
              extended by com.rapidminer.tools.math.container.BoundedPriorityQueue<E>
Type Parameters:
E -
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Queue<E>

public class BoundedPriorityQueue<E>
extends java.util.PriorityQueue<E>

This class implements a bounded priority queue which contains always the n-th smalles values. If a new value is added, its only added if smaller than the greatest value already in queue. The greatest value is then removed. The iterator does not iterate in any particular order. This queue will implement a reverse order in compare with the java PriorityQueue, so peek and poll will retrieve the greatest elements

Author:
Sebastian Land
See Also:
Serialized Form

Constructor Summary
BoundedPriorityQueue(int bound)
           
BoundedPriorityQueue(int bound, java.util.Comparator<? super E> comp)
           
 
Method Summary
 boolean add(E e)
           
 boolean isFilled()
           
 boolean offer(E e)
           
 
Methods inherited from class java.util.PriorityQueue
clear, comparator, contains, iterator, peek, poll, remove, size, toArray, toArray
 
Methods inherited from class java.util.AbstractQueue
addAll, element, remove
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
containsAll, equals, hashCode, isEmpty, removeAll, retainAll
 

Constructor Detail

BoundedPriorityQueue

public BoundedPriorityQueue(int bound)

BoundedPriorityQueue

public BoundedPriorityQueue(int bound,
                            java.util.Comparator<? super E> comp)
Method Detail

offer

public boolean offer(E e)
Specified by:
offer in interface java.util.Queue<E>
Overrides:
offer in class java.util.PriorityQueue<E>

add

public boolean add(E e)
Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.Queue<E>
Overrides:
add in class java.util.PriorityQueue<E>

isFilled

public boolean isFilled()


Copyright © 2001-2009 by Rapid-I