protected class NearestNeighbourSearch.NeighborList extends Object
Modifier and Type | Field and Description |
---|---|
protected NearestNeighbourSearch.NeighborNode |
m_First
The first node in the list.
|
protected NearestNeighbourSearch.NeighborNode |
m_Last
The last node in the list.
|
protected int |
m_Length
The number of nodes to attempt to maintain in the list.
|
Constructor and Description |
---|
NearestNeighbourSearch.NeighborList(int length)
Creates the neighborlist with a desired length.
|
Modifier and Type | Method and Description |
---|---|
int |
currentLength()
Gets the current length of the list.
|
NearestNeighbourSearch.NeighborNode |
getFirst()
returns the first element in the list.
|
NearestNeighbourSearch.NeighborNode |
getLast()
returns the last element in the list.
|
void |
insertSorted(double distance,
weka.core.Instance instance)
Inserts an instance neighbor into the list, maintaining the list
sorted by distance.
|
boolean |
isEmpty()
Gets whether the list is empty.
|
void |
printList()
Prints out the contents of the neighborlist.
|
void |
pruneToK(int k)
Prunes the list to contain the k nearest neighbors.
|
protected NearestNeighbourSearch.NeighborNode m_First
protected NearestNeighbourSearch.NeighborNode m_Last
protected int m_Length
public NearestNeighbourSearch.NeighborList(int length)
length
- the length of list to attempt to maintainpublic boolean isEmpty()
public int currentLength()
public void insertSorted(double distance, weka.core.Instance instance)
distance
- the distance to the instanceinstance
- the neighboring instancepublic void pruneToK(int k)
k
- the number of neighbors to keep in the list.public void printList()
public NearestNeighbourSearch.NeighborNode getFirst()
public NearestNeighbourSearch.NeighborNode getLast()
Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.