|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jdsl.core.ref.BTHeap
A Heap implementation of PriorityQueue. This heap is based on a Binary Tree.
| Constructor Summary | |
BTHeap()
Deprecated. Use the constructor with a comparator parameter |
|
BTHeap(Comparator comparator)
Class constructor. |
|
| Method Summary | |
Comparator |
comparator()
Retrieves the Comparator. |
java.util.Enumeration |
elements()
Returns an Enumeration of all the elements within this
Container. |
InspectableBinaryTree |
getBinaryTree()
Returns the underlying binary tree() in this heap. |
InspectableBinaryTree |
getTree()
Returns the underlying InspectableBinaryTree. |
void |
insert(Locator locator)
Inserts a Locator into this Container. |
Locator |
insert(java.lang.Object key,
java.lang.Object element)
Inserts a <key, element> pair into this Container. |
void |
insertItem(java.lang.Object key,
java.lang.Object element)
Add a (key,element) pair to the set maintained by the priority queue, making whatever internal adjustments are necessary. |
boolean |
isEmpty()
Tests if the container is empty. |
java.util.Enumeration |
keys()
Returns an Enumeration of all the keys within this Container. |
java.util.Enumeration |
locators()
Returns an Enumeration of all the Locators within this
Container. |
Locator |
makeLocator(java.lang.Object key,
java.lang.Object element)
For when you need a locator that can be inserted into this KeyBasedContainer but don't want to insert it quite yet. |
Locator |
min()
Allows access to element with first priority without removing it from the PriorityQueue. |
java.lang.Object |
minElement()
Inspect the element (not the key) with first priority, without modifying the priority queue. |
java.lang.Object |
minKey()
Inspect the key with first priority, without modifying the priority queue. |
Container |
newContainer()
|
void |
remove(Locator locator)
Removes an element from this Container. |
java.lang.Object |
removeMinElement()
Remove a (key,element) pair with first priority, making whatever internal adjustments are necessary. |
java.lang.Object |
replaceElement(Locator loc,
java.lang.Object newElement)
Takes constant time -- even in key-based containers, since the element can be changed independently of the key. |
java.lang.Object |
replaceKey(Locator locator,
java.lang.Object key)
Changes the mapping of a Locator's element to a new key. |
Comparator |
setComparator(Comparator c)
This method establishes a ContainerInterfaces.Comparator that an ordered container should use to compare its elements. |
int |
size()
Number of elements in the container. |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public BTHeap()
public BTHeap(Comparator comparator)
| Method Detail |
public Comparator comparator()
Comparator.Comparator that is used by this
PriorityQueue.
public Locator min()
throws EmptyContainerException
public java.lang.Object minElement()
throws EmptyContainerException
public java.lang.Object minKey()
throws EmptyContainerException
public void insertItem(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException
key - An object comparable under the implementation's
comparison schemeelement - An arbitrary object the client associates with
the key
public java.lang.Object removeMinElement()
throws EmptyContainerException
public InspectableBinaryTree getTree()
public Comparator setComparator(Comparator c)
c - A ContainerInterfaces.Comparator appropriate to the
elements stored by the containerpublic InspectableBinaryTree getBinaryTree()
public void insert(Locator locator)
throws InvalidKeyException,
InvalidLocatorException,
ContainedLocatorException
locator - The Locator that is inserted into this Container.
public Locator insert(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException
key is an explicit key. That is, it is mapped to
element and used to position element within
this Container.key - The key used to position the element
within this Container.element - The element to be inserted into this
Container.element
within this Container.key
is not a type accepted by this Container (For
example: This Container is unable to use
key as a key).
public void remove(Locator locator)
throws InvalidLocatorException,
UncontainedLocatorException
locator - The Locator which points to a particular element within
this Container.locator is invalid
(For example: It does not actually reference an element in this
Container).locator is not
contained.
public java.lang.Object replaceKey(Locator locator,
java.lang.Object key)
throws InvalidLocatorException,
InvalidKeyException,
UncontainedLocatorException
locator's element will now be mapped to
key. The original key this element was mapped to is returned
Note: this method does not necessarily remove the old key (other
elements within this Container may be mapped to it).locator - The Locator which points to a particular
element within this Container.key - The new key to which locator's
element should be mapped.locator's element
was mapped.locator is
invalid (For example: It does not actually reference
an element in this Container).key
is not a type accepted by this Container (e.g. If
this Container is unable to use key
as a key).locator isn't
contained.
public java.lang.Object replaceElement(Locator loc,
java.lang.Object newElement)
throws InvalidLocatorException,
UncontainedLocatorException
loc - Locator at which replacement should occurnewElement - Element now to be stored at Locator locloc is uncontained.public java.util.Enumeration locators()
Locators within this
Container. If this Container is empty then an empty
Enumeration is returned.Locators stored in the
container. Note: this Enumeration may be empty.elements,
Enumerationpublic java.util.Enumeration keys()
Enumeration is returned.elements,
Enumeration
public Locator makeLocator(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException
key - the key that represents the element in this locator.element - the element for this locator.public java.util.Enumeration elements()
Enumeration of all the elements within this
Container. If this Container is empty then an empty Enumeration is
returned.locators,
Enumerationpublic Container newContainer()
public int size()
public boolean isEmpty()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||