org.pcollections
Class AmortizedPQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by org.pcollections.AmortizedPQueue<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>, PCollection<E>, PQueue<E>

public class AmortizedPQueue<E>
extends AbstractQueue<E>
implements PQueue<E>

Author:
mtklein

Method Summary
static
<E> AmortizedPQueue<E>
empty()
           
 Iterator<E> iterator()
           
static void main(String[] args)
           
 AmortizedPQueue<E> minus()
           
 PCollection<E> minus(Object e)
           
 PCollection<E> minusAll(Collection<?> list)
           
 boolean offer(E o)
           
 E peek()
           
 AmortizedPQueue<E> plus(E e)
           
 AmortizedPQueue<E> plusAll(Collection<? extends E> list)
           
 E poll()
           
 int size()
           
 
Methods inherited from class java.util.AbstractQueue
add, addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pcollections.PQueue
remove
 
Methods inherited from interface org.pcollections.PCollection
add, addAll, clear, remove, removeAll, retainAll
 
Methods inherited from interface java.util.Queue
add, element
 
Methods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, toArray, toArray
 

Method Detail

empty

public static <E> AmortizedPQueue<E> empty()

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in class AbstractCollection<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in class AbstractCollection<E>

peek

public E peek()
Specified by:
peek in interface Queue<E>

minus

public AmortizedPQueue<E> minus()
Specified by:
minus in interface PQueue<E>

plus

public AmortizedPQueue<E> plus(E e)
Specified by:
plus in interface PCollection<E>
Specified by:
plus in interface PQueue<E>
Parameters:
e - non-null
Returns:
a collection which contains e and all of the elements of this

plusAll

public AmortizedPQueue<E> plusAll(Collection<? extends E> list)
Specified by:
plusAll in interface PCollection<E>
Specified by:
plusAll in interface PQueue<E>
Parameters:
list - contains no null elements
Returns:
a collection which contains all of the elements of list and this

minus

public PCollection<E> minus(Object e)
Specified by:
minus in interface PCollection<E>
Specified by:
minus in interface PQueue<E>
Returns:
this with a single instance of e removed, if e is in this

minusAll

public PCollection<E> minusAll(Collection<?> list)
Specified by:
minusAll in interface PCollection<E>
Specified by:
minusAll in interface PQueue<E>
Returns:
this with all elements of list completely removed

offer

public boolean offer(E o)
Specified by:
offer in interface Queue<E>
Specified by:
offer in interface PQueue<E>

poll

public E poll()
Specified by:
poll in interface Queue<E>
Specified by:
poll in interface PQueue<E>

main

public static void main(String[] args)


Copyright © 2011. All Rights Reserved.