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, shortValue
requiredInputPattern, testInputPattern
public 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)
NumberDistance
fromDouble
in class NumberDistance<BitDistance,Bit>
val
- Valuepublic boolean bitValue()
public void writeExternal(ObjectOutput out) throws IOException
IOException
public void readExternal(ObjectInput in) throws IOException
IOException
public int externalizableSize()
public 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)
public BitDistance parseString(String val) throws IllegalArgumentException
Distance
val
- 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()
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>
public String toString()
Distance
toString
in interface Distance<BitDistance>
toString
in class Object
public int hashCode()
AbstractDistance
hashCode
in class AbstractDistance<BitDistance>
public boolean equals(Object obj)
AbstractDistance
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.equals
in class AbstractDistance<BitDistance>