public class VPHashTree extends VPTree<VPPoint> implements HashFunction<Metadata>
ByteSerializable.Deserialize
binSize, DEFAULT_BIN_SIZE, root
Constructor and Description |
---|
VPHashTree(int depth)
Constructs a new, empty vp-tree with a default node capacity.
|
VPHashTree(int depth,
java.util.ArrayList<? extends VPPoint> points,
int nodeCapacity)
Constructs a new vp-tree that contains (and indexes) all of the points in
the given collection and has leaf nodes with the given point capacity.
|
VPHashTree(int depth,
java.util.Collection<? extends VPPoint> points)
Constructs a new vp-tree that contains (and indexes) all of the points in
the given collection.
|
VPHashTree(int depth,
int nodeCapacity)
Constructs a new, empty vp-tree with the specified node capacity.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getHashTreeDOT() |
java.math.BigInteger |
hash(Metadata metadata)
Hashes the metadata in the tree.
|
long |
lookup(VPPoint value)
Finds the prefix value in the hash tree of the specified @code{VPPoint}.
|
java.math.BigInteger |
maxValue()
Determines the maximum hash value that this hash function can produce.
|
java.math.BigInteger |
randomHash()
Returns a random location in the hash space.
|
add, addAll, clear, contains, containsAll, generateDot, getBinSize, getNearestNeighbor, getNearestNeighbors, getPrefixOf, getPrefixOf, getRoot, isEmpty, pruneEmptyNode, remove, remove, removeAll, serialize, size, toArray, toArray
public VPHashTree(int depth)
public VPHashTree(int depth, int nodeCapacity)
depth
- height of the tree where to draw the cutoff for
hashing pathsnodeCapacity
- the maximum number of points to store in a leaf node
of the vp-treepublic VPHashTree(int depth, java.util.Collection<? extends VPPoint> points)
depth
- height of the tree where to draw the cutoff for
hashing pathspoints
- the points to use to populate this vp-treepublic VPHashTree(int depth, java.util.ArrayList<? extends VPPoint> points, int nodeCapacity)
depth
- height of the tree where to draw the cutoff for
hashing pathspoints
- the points to use to populate this vp-treenodeCapacity
- the largest number of points any leaf node of thepublic long lookup(VPPoint value) throws HashException
value
- the value to find a prefix forHashException
- when the tree does not contain enough nodes to
reach the depth thresholdpublic java.math.BigInteger hash(Metadata metadata) throws HashException
hash
in interface HashFunction<Metadata>
metadata
- the @code{Metadata} containing the @code{VPPoint} to get
a hash value forHashException
- when the tree does not contain enough nodes to
reach the depth thresholdpublic java.math.BigInteger maxValue()
HashFunction
maxValue
in interface HashFunction<Metadata>
public java.math.BigInteger randomHash() throws HashException
HashFunction
randomHash
in interface HashFunction<Metadata>
HashException
public java.lang.String getHashTreeDOT()