PenProfile 2.x

com.livescribe.ext.util
Class PriorityQueue

java.lang.Object
  extended by com.livescribe.ext.util.PriorityQueue
All Implemented Interfaces:
Cloneable, Collection, Queue

public class PriorityQueue
extends Object
implements Cloneable, Queue

PriorityQueue implements the standard Java SE class Underlying implementation is a standard heap


Constructor Summary
PriorityQueue()
           
PriorityQueue(Collection c)
           
PriorityQueue(Enumeration en)
           
PriorityQueue(int initialCapacity)
           
PriorityQueue(Object[] o)
           
 
Method Summary
 boolean add(Object element)
          Inserts object into queue
 boolean addAll(Collection c)
          Adds all elements of the collection to the priority queue
 void clear()
          Clears queue
 Object clone()
          Create a shallow copy of the array
 boolean contains(Object o)
          Returns true if object exists in queue
 boolean containsAll(Collection c)
          Check if priority queue contains all the objects in the collection
 Object element()
          Retrieves but does not remove the first element in the queue
 boolean isEmpty()
          Check if the queue is empty
 Iterator iterator()
           
 boolean offer(Object element)
          Inserts object into queue
 Object peek()
          Looks at first element but does not remove
 Object poll()
          Gets the first element from queue
 Object remove()
          Removes the first element from the queue
 boolean remove(Object o)
          Removes a single object from the queue
 boolean removeAll(Collection c)
          Remove all objects in the collection from the priority queue
 boolean retainAll(Collection c)
          Remove all but the objects in the PriorityQueue but the objects in the collection
 int size()
          Returns the number of objects
 Object[] toArray()
          Returns an array of all the objects in the queue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.livescribe.ext.util.Collection
equals, hashCode
 

Constructor Detail

PriorityQueue

public PriorityQueue()

PriorityQueue

public PriorityQueue(int initialCapacity)

PriorityQueue

public PriorityQueue(Collection c)

PriorityQueue

public PriorityQueue(Enumeration en)

PriorityQueue

public PriorityQueue(Object[] o)
Method Detail

add

public boolean add(Object element)
Inserts object into queue

Specified by:
add in interface Collection
Parameters:
element -
Returns:

clear

public void clear()
Clears queue

Specified by:
clear in interface Collection

contains

public boolean contains(Object o)
Returns true if object exists in queue

Specified by:
contains in interface Collection
Parameters:
o -
Returns:

iterator

public Iterator iterator()
Specified by:
iterator in interface Collection

offer

public boolean offer(Object element)
Inserts object into queue

Specified by:
offer in interface Queue

peek

public Object peek()
Looks at first element but does not remove

Specified by:
peek in interface Queue
Returns:

poll

public Object poll()
Gets the first element from queue

Specified by:
poll in interface Queue
Returns:

element

public Object element()
Retrieves but does not remove the first element in the queue

Specified by:
element in interface Queue

remove

public Object remove()
Removes the first element from the queue

Specified by:
remove in interface Queue

remove

public boolean remove(Object o)
Removes a single object from the queue

Specified by:
remove in interface Collection
Parameters:
o -
Returns:

size

public int size()
Returns the number of objects

Specified by:
size in interface Collection
Returns:

toArray

public Object[] toArray()
Returns an array of all the objects in the queue

Specified by:
toArray in interface Collection
Returns:

clone

public Object clone()
Create a shallow copy of the array

Specified by:
clone in interface Cloneable
Returns:

addAll

public boolean addAll(Collection c)
Adds all elements of the collection to the priority queue

Specified by:
addAll in interface Collection

containsAll

public boolean containsAll(Collection c)
Check if priority queue contains all the objects in the collection

Specified by:
containsAll in interface Collection

isEmpty

public boolean isEmpty()
Check if the queue is empty

Specified by:
isEmpty in interface Collection

removeAll

public boolean removeAll(Collection c)
Remove all objects in the collection from the priority queue

Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection c)
Remove all but the objects in the PriorityQueue but the objects in the collection

Specified by:
retainAll in interface Collection

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.