
public class BitDistance extends NumberDistance<BitDistance,Bit>
| Modifier and Type | Field and Description |
|---|---|
static BitDistance |
FACTORY
The static factory instance
|
private static long |
serialVersionUID
Generated serial version UID
|
private boolean |
value
The distance value
|
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)
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.
|
byteValue, floatValue, hashCode, shortValue, toStringequals, requiredInputPattern, testInputPatternpublic static final BitDistance FACTORY
private boolean value
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 BitDistance plus(BitDistance distance)
Distancedistance - the distance to be added to this distancepublic BitDistance minus(BitDistance distance)
Distancedistance - the distance to be subtracted from this distancepublic boolean bitValue()
public void writeExternal(ObjectOutput out) throws IOException
IOExceptionpublic void readExternal(ObjectInput in) throws IOException
IOExceptionpublic int externalizableSize()
public Bit getValue()
NumberDistancegetValue in class NumberDistance<BitDistance,Bit>void setValue(Bit value)
NumberDistancesetValue in class NumberDistance<BitDistance,Bit>value - the value to be setpublic 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)
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 objectpublic 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>