jsat.utils
Class IntPriorityQueue
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<java.lang.Integer>
-
- jsat.utils.IntPriorityQueue
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.Queue<java.lang.Integer>
public class IntPriorityQueue extends java.util.AbstractQueue<java.lang.Integer> implements java.io.SerializableThis class represents a priority queue specifically designed to contain integer keys, and uses less memory then aPriorityQueuefilled with integers. This queue can optionally support log(n) removal of key values at increased memory cost.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classIntPriorityQueue.ModeSets the mode used for the priority queue.
-
Field Summary
Fields Modifier and Type Field and Description static java.util.Comparator<java.lang.Integer>naturalComparator
-
Constructor Summary
Constructors Constructor and Description IntPriorityQueue()Creates a new integer priority queue usingIntPriorityQueue.Mode.STANDARDIntPriorityQueue(int initialSize, java.util.Comparator<java.lang.Integer> comparator)Creates a new integer priority queue using the specified comparison andIntPriorityQueue.Mode.STANDARDIntPriorityQueue(int initialSize, java.util.Comparator<java.lang.Integer> comparator, IntPriorityQueue.Mode fastValueRemove)Creates a new integer priority queueIntPriorityQueue(int initialSize, IntPriorityQueue.Mode fastValueRemove)Creates a new integer priority queue
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()booleancontains(java.lang.Object o)java.util.Iterator<java.lang.Integer>iterator()booleanoffer(int e)booleanoffer(java.lang.Integer e)java.lang.Integerpeek()java.lang.Integerpoll()booleanremove(java.lang.Object o)intsize()-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
naturalComparator
public static final java.util.Comparator<java.lang.Integer> naturalComparator
-
-
Constructor Detail
-
IntPriorityQueue
public IntPriorityQueue()
Creates a new integer priority queue usingIntPriorityQueue.Mode.STANDARD
-
IntPriorityQueue
public IntPriorityQueue(int initialSize, java.util.Comparator<java.lang.Integer> comparator)Creates a new integer priority queue using the specified comparison andIntPriorityQueue.Mode.STANDARD- Parameters:
initialSize- the initial storage size of the queuecomparator- the comparator to determine the order of elements in the queue
-
IntPriorityQueue
public IntPriorityQueue(int initialSize, IntPriorityQueue.Mode fastValueRemove)Creates a new integer priority queue- Parameters:
initialSize- the initial storage size of the queuefastValueRemove- the mode that whether or not, and how, fast arbitrary object removal from the queue will be done.
-
IntPriorityQueue
public IntPriorityQueue(int initialSize, java.util.Comparator<java.lang.Integer> comparator, IntPriorityQueue.Mode fastValueRemove)Creates a new integer priority queue- Parameters:
initialSize- the initial storage size of the queuecomparator- the comparator to determine the order of elements in the queuefastValueRemove- the mode that whether or not, and how, fast arbitrary object removal from the queue will be done.
-
-
Method Detail
-
iterator
public java.util.Iterator<java.lang.Integer> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Integer>- Specified by:
iteratorin interfacejava.util.Collection<java.lang.Integer>- Specified by:
iteratorin classjava.util.AbstractCollection<java.lang.Integer>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<java.lang.Integer>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Integer>
-
offer
public boolean offer(java.lang.Integer e)
- Specified by:
offerin interfacejava.util.Queue<java.lang.Integer>
-
offer
public boolean offer(int e)
-
poll
public java.lang.Integer poll()
- Specified by:
pollin interfacejava.util.Queue<java.lang.Integer>
-
peek
public java.lang.Integer peek()
- Specified by:
peekin interfacejava.util.Queue<java.lang.Integer>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<java.lang.Integer>- Overrides:
containsin classjava.util.AbstractCollection<java.lang.Integer>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<java.lang.Integer>- Overrides:
clearin classjava.util.AbstractQueue<java.lang.Integer>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<java.lang.Integer>- Overrides:
removein classjava.util.AbstractCollection<java.lang.Integer>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG