protected class NearestNeighbourSearch.MyHeap extends Object
| Constructor and Description |
|---|
NearestNeighbourSearch.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.
|
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 NearestNeighbourSearch.MyHeap(int maxSize)
maxSize - the maximum size of the heappublic int size()
public NearestNeighbourSearch.MyHeapElement peek()
public NearestNeighbourSearch.MyHeapElement get() throws Exception
Exception - if no elements in heappublic void put(int i,
double d)
throws Exception
i - the indexd - the distanceException - if the heap gets too largepublic void putBySubstitute(int i,
double d)
throws Exception
i - the indexd - the distanceException - 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()
Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.