|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance<D>
de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance<BitDistance,Bit>
de.lmu.ifi.dbs.elki.distance.distancevalue.BitDistance
public class BitDistance

Provides a Distance for a bit-valued distance.
| Field Summary | |
|---|---|
static BitDistance |
FACTORY
The static factory instance |
private static long |
serialVersionUID
Generated serial version UID |
private boolean |
value
The distance value |
| Fields inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance |
|---|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN |
| Constructor Summary | |
|---|---|
BitDistance()
Empty constructor for serialization purposes. |
|
BitDistance(Bit bit)
Constructs a new BitDistance object that represents the bit argument. |
|
BitDistance(boolean bit)
Constructs a new BitDistance object that represents the bit argument. |
|
| Method Summary | |
|---|---|
boolean |
bitValue()
Returns the value of this BitDistance as a boolean. |
int |
compareTo(BitDistance other)
Compares this NumberDistance with the given NumberDistance wrt the represented value. |
double |
doubleValue()
Get the value as double. |
int |
externalizableSize()
Returns the number of Bytes this distance uses if it is written to an external file. |
BitDistance |
fromDouble(double val)
Build a new instance from a double value. |
Pattern |
getPattern()
Get the pattern accepted by this distance |
Bit |
getValue()
Returns the value of this NumberDistance. |
BitDistance |
infiniteDistance()
Provides an infinite distance. |
int |
intValue()
Get the value as int. |
boolean |
isInfiniteDistance()
Returns true, if the distance is an infinite distance, false otherwise. |
boolean |
isNullDistance()
Returns true, if the distance is a null distance, false otherwise. |
boolean |
isUndefinedDistance()
Returns true, if the distance is an undefined distance, false otherwise. |
long |
longValue()
Get the value as long. |
BitDistance |
minus(BitDistance distance)
Returns a new Distance by subtracting the given distance from this distance. |
BitDistance |
nullDistance()
Provides a null distance. |
BitDistance |
parseString(String val)
Provides a measurement suitable to this measurement function based on the given pattern. |
BitDistance |
plus(BitDistance distance)
Returns a new distance as sum of this distance and the given distance. |
void |
readExternal(ObjectInput in)
Reads the bit value of this BitDistance from the specified stream. |
(package private) void |
setValue(Bit value)
Sets the value of this NumberDistance. |
BitDistance |
undefinedDistance()
Provides an undefined distance. |
void |
writeExternal(ObjectOutput out)
Writes the bit value of this BitDistance to the specified stream. |
| Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance |
|---|
byteValue, floatValue, hashCode, shortValue, toString |
| Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance |
|---|
equals, requiredInputPattern, testInputPattern |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final BitDistance FACTORY
private boolean value
private static final long serialVersionUID
| Constructor Detail |
|---|
public BitDistance()
public BitDistance(boolean bit)
bit - the value to be represented by the BitDistance.public BitDistance(Bit bit)
bit - the value to be represented by the BitDistance.| Method Detail |
|---|
public BitDistance fromDouble(double val)
NumberDistance
fromDouble in class NumberDistance<BitDistance,Bit>val - Value
public BitDistance plus(BitDistance distance)
Distance
distance - the distance to be added to this distance
public BitDistance minus(BitDistance distance)
Distance
distance - the distance to be subtracted from this distance
public boolean bitValue()
public void writeExternal(ObjectOutput out)
throws IOException
IOException
public void readExternal(ObjectInput in)
throws IOException
IOExceptionpublic int externalizableSize()
public Bit getValue()
NumberDistance
getValue in class NumberDistance<BitDistance,Bit>void setValue(Bit value)
NumberDistance
setValue in class NumberDistance<BitDistance,Bit>value - the value to be setpublic double doubleValue()
NumberDistance
doubleValue in class NumberDistance<BitDistance,Bit>public long longValue()
NumberDistance
longValue in class NumberDistance<BitDistance,Bit>public int intValue()
NumberDistance
intValue in class NumberDistance<BitDistance,Bit>public int compareTo(BitDistance other)
NumberDistanced1.compareTo(d2) is the same as
Double.compare(d1.value.doubleValue(),
d2.value.doubleValue()). Subclasses may need to overwrite this method if
necessary.
compareTo in interface Comparable<BitDistance>compareTo in class NumberDistance<BitDistance,Bit>other - Other object
public BitDistance parseString(String val)
throws IllegalArgumentException
Distance
val - a pattern defining a similarity suitable to this measurement
function
IllegalArgumentException - if the given pattern is not compatible
with the requirements of this measurement functionpublic BitDistance infiniteDistance()
Distance
public BitDistance nullDistance()
Distance
public BitDistance undefinedDistance()
Distance
public Pattern getPattern()
AbstractDistance
getPattern in class AbstractDistance<BitDistance>public boolean isInfiniteDistance()
Distance
isInfiniteDistance in interface Distance<BitDistance>isInfiniteDistance in class AbstractDistance<BitDistance>public boolean isNullDistance()
Distance
isNullDistance in interface Distance<BitDistance>isNullDistance in class AbstractDistance<BitDistance>public boolean isUndefinedDistance()
Distance
isUndefinedDistance in interface Distance<BitDistance>isUndefinedDistance in class AbstractDistance<BitDistance>
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||