com.meapsoft
Class ChunkDist
java.lang.Object
com.meapsoft.ChunkDist
- All Implemented Interfaces:
- java.util.Comparator, java.io.Serializable
- Direct Known Subclasses:
- CosineDist, EuclideanDist
- public abstract class ChunkDist
- extends java.lang.Object
- implements java.io.Serializable, java.util.Comparator
A way to measure the distance between two chunks. Constructor can
accept another ChunkDist, which will be added to the first
distance, so that distance measures can be chained together.
- See Also:
- Serialized Form
Method Summary |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compare two Chunk's based on their distances from targetChunk |
double |
distance(Chunk c1,
Chunk c2)
Compute distance between two Chunks |
boolean |
equals(java.lang.Object obj)
|
void |
setTarget(Chunk t)
Set target chunk for compare function to use. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
targetChunk
public Chunk targetChunk
next
public ChunkDist next
featdim
public int[] featdim
ChunkDist
public ChunkDist()
ChunkDist
public ChunkDist(ChunkDist next)
ChunkDist
public ChunkDist(int[] fd)
ChunkDist
public ChunkDist(ChunkDist next,
int[] fd)
distance
public double distance(Chunk c1,
Chunk c2)
- Compute distance between two Chunks
setTarget
public void setTarget(Chunk t)
- Set target chunk for compare function to use. This needs to be
called before compare() is called or there will be
NullPointerExceptions.
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
throws java.lang.ClassCastException
- Compare two Chunk's based on their distances from targetChunk
- Specified by:
compare
in interface java.util.Comparator
- Throws:
java.lang.ClassCastException
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interface java.util.Comparator