Facemorph.multifilter
Class PQplus

java.lang.Object
  extended by Facemorph.multifilter.PQplus

public class PQplus
extends java.lang.Object

PQ which supports on-the-fly updates to values in the queue


Constructor Summary
PQplus()
          Default constructor
PQplus(int maxsize)
          Constructor with an initial capacity
 
Method Summary
 void add(PQplusElement c)
          Add an element to the heap
 void clear()
          Empty the array, alternatively could reallocate
 PQplusElement inspectLeast()
          Inspect but don't remove the smallest element
 boolean isEmpty()
          Check if the heap is empty
static void main(java.lang.String[] args)
          Main method for testing
 PQplusElement removeLeast()
          Remove the smallest element and return it
 int size()
          Return the number of elements in the heap
 void update(PQplusElement c)
          Alter the value of the element in place and adjust the PQ appropriately
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PQplus

public PQplus()
Default constructor


PQplus

public PQplus(int maxsize)
Constructor with an initial capacity

Parameters:
maxsize - the initial capacity
Method Detail

inspectLeast

public PQplusElement inspectLeast()
Inspect but don't remove the smallest element

Returns:
return the smallest element

clear

public void clear()
Empty the array, alternatively could reallocate


isEmpty

public boolean isEmpty()
Check if the heap is empty

Returns:
return true if the PQ is empty

size

public int size()
Return the number of elements in the heap

Returns:
return the number of elements in the heap

removeLeast

public PQplusElement removeLeast()
Remove the smallest element and return it

Returns:
the smallest element from the heap

add

public void add(PQplusElement c)
Add an element to the heap

Parameters:
c - the new element for insertion

update

public void update(PQplusElement c)
Alter the value of the element in place and adjust the PQ appropriately

Parameters:
c - the element to adjust

main

public static void main(java.lang.String[] args)
Main method for testing

Parameters:
args - the program arguments