protected class CoverTree.MyHeap extends Object implements RevisionHandler
Constructor and Description |
---|
MyHeap(int maxSize)
constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
downheap()
performs downheap operation for the heap
to maintian its properties.
|
CoverTree.MyHeapElement |
get()
returns the first element and removes it from the heap.
|
CoverTree.MyHeapElement |
getKthNearest()
returns the kth nearest element or null if none there.
|
String |
getRevision()
Returns the revision string.
|
int |
noOfKthNearest()
returns the number of k nearest.
|
CoverTree.MyHeapElement |
peek()
peeks at the first element.
|
void |
put(double d)
adds the distance value to the heap.
|
void |
putBySubstitute(double d)
Puts an element by substituting it in place of
the top most element.
|
void |
putKthNearest(double d)
Stores kth nearest elements (if there are
more than one).
|
int |
size()
returns the size of the heap.
|
int |
totalSize()
returns the total size.
|
protected void |
upheap()
performs upheap operation for the heap
to maintian its properties.
|
public MyHeap(int maxSize)
maxSize
- the maximum size of the heappublic int size()
public CoverTree.MyHeapElement peek()
public CoverTree.MyHeapElement get() throws Exception
Exception
- if no elements in heappublic void put(double d) throws Exception
d
- the distance valueException
- if the heap gets too largepublic void putBySubstitute(double d) throws Exception
d
- The distance value.Exception
- If distance is smaller than that of the head
element.public int noOfKthNearest()
m_KthNearestSize
public void putKthNearest(double d)
d
- the distancepublic CoverTree.MyHeapElement getKthNearest()
protected void upheap()
protected void downheap()
public int totalSize()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.