
public class BitDistance extends NumberDistance<BitDistance,Bit>
| Modifier and Type | Field and Description |
|---|---|
static BitDistance |
FACTORY
The static factory instance
|
static BitDistance |
ONE
Distance 1.
|
private static long |
serialVersionUID
Generated serial version UID
|
private boolean |
value
The distance value
|
static BitDistance |
ZERO
Distance 0.
|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
bitValue()
Returns the value of this BitDistance as a boolean.
|
int |
compareTo(BitDistance other) |
double |
doubleValue()
Get the value as double.
|
boolean |
equals(Object obj)
Returns true if
this == o has the value true or o
is not null and o is of the same class as this instance and
this.compareTo(o) is 0, false otherwise. |
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
|
int |
hashCode()
Any extending class should implement a proper hashCode method.
|
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 |
nullDistance()
Provides a null distance.
|
BitDistance |
parseString(String val)
Provides a measurement suitable to this measurement function based on the
given pattern.
|
void |
readExternal(ObjectInput in)
Reads the bit value of this BitDistance from the specified stream.
|
String |
toString()
Any implementing class should implement a proper toString-method for
printing the result-values.
|
BitDistance |
undefinedDistance()
Provides an undefined distance.
|
void |
writeExternal(ObjectOutput out)
Writes the bit value of this BitDistance to the specified stream.
|
byteValue, floatValue, shortValuerequiredInputPattern, testInputPatternpublic static final BitDistance FACTORY
private boolean value
public static final BitDistance ZERO
public static final BitDistance ONE
private static final long serialVersionUID
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.public BitDistance fromDouble(double val)
NumberDistancefromDouble in class NumberDistance<BitDistance,Bit>val - Valuepublic boolean bitValue()
public void writeExternal(ObjectOutput out) throws IOException
IOExceptionpublic void readExternal(ObjectInput in) throws IOException
IOExceptionpublic int externalizableSize()
public double doubleValue()
NumberDistancedoubleValue in class NumberDistance<BitDistance,Bit>public long longValue()
NumberDistancelongValue in class NumberDistance<BitDistance,Bit>public int intValue()
NumberDistanceintValue in class NumberDistance<BitDistance,Bit>public int compareTo(BitDistance other)
public BitDistance parseString(String val) throws IllegalArgumentException
Distanceval - a pattern defining a similarity suitable to this measurement
functionIllegalArgumentException - if the given pattern is not compatible
with the requirements of this measurement functionpublic BitDistance infiniteDistance()
Distancepublic BitDistance nullDistance()
Distancepublic BitDistance undefinedDistance()
Distancepublic Pattern getPattern()
AbstractDistancegetPattern in class AbstractDistance<BitDistance>public boolean isInfiniteDistance()
DistanceisInfiniteDistance in interface Distance<BitDistance>isInfiniteDistance in class AbstractDistance<BitDistance>public boolean isNullDistance()
DistanceisNullDistance in interface Distance<BitDistance>isNullDistance in class AbstractDistance<BitDistance>public boolean isUndefinedDistance()
DistanceisUndefinedDistance in interface Distance<BitDistance>isUndefinedDistance in class AbstractDistance<BitDistance>public String toString()
DistancetoString in interface Distance<BitDistance>toString in class Objectpublic int hashCode()
AbstractDistancehashCode in class AbstractDistance<BitDistance>public boolean equals(Object obj)
AbstractDistancethis == o has the value true or o
is not null and o is of the same class as this instance and
this.compareTo(o) is 0, false otherwise.equals in class AbstractDistance<BitDistance>