protected class NearestNeighbourSearch.MyHeap extends java.lang.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.
|
NearestNeighbourSearch.MyHeapElement |
get()
returns the first element and removes it from the heap.
|
NearestNeighbourSearch.MyHeapElement |
getKthNearest()
returns the kth nearest element or null if none there.
|
java.lang.String |
getRevision()
Returns the revision string.
|
int |
noOfKthNearest()
returns the number of k nearest.
|
NearestNeighbourSearch.MyHeapElement |
peek()
peeks at the first element.
|
void |
put(int i,
double d)
adds the value to the heap.
|
void |
putBySubstitute(int i,
double d)
Puts an element by substituting it in place of the top most element.
|
void |
putKthNearest(int i,
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 NearestNeighbourSearch.MyHeapElement peek()
public NearestNeighbourSearch.MyHeapElement get() throws java.lang.Exception
java.lang.Exception - if no elements in heappublic void put(int i,
double d)
throws java.lang.Exception
i - the indexd - the distancejava.lang.Exception - if the heap gets too largepublic void putBySubstitute(int i,
double d)
throws java.lang.Exception
i - the indexd - the distancejava.lang.Exception - if distance is smaller than that of the head elementpublic int noOfKthNearest()
m_KthNearestSizepublic void putKthNearest(int i,
double d)
i - the indexd - the distancepublic NearestNeighbourSearch.MyHeapElement getKthNearest()
protected void upheap()
protected void downheap()
public int totalSize()
public java.lang.String getRevision()
getRevision in interface RevisionHandler