protected class NearestNeighbourSearch.NeighborList extends Object implements RevisionHandler
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 |
---|
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.
|
String |
getRevision()
Returns the revision string.
|
void |
insertSorted(double distance,
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 NeighborList(int length)
length
- the length of list to attempt to maintainpublic boolean isEmpty()
public int currentLength()
public void insertSorted(double distance, 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()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.