public class FloatDistance extends NumberDistance<FloatDistance,Float>
Modifier and Type | Field and Description |
---|---|
static FloatDistance |
FACTORY
The static factory instance
|
static FloatDistance |
INFINITE_DISTANCE
Infinite distance.
|
private static long |
serialVersionUID
Generated serialVersionUID.
|
static FloatDistance |
UNDEFINED_DISTANCE
Undefined distance.
|
private float |
value
The distance value.
|
static FloatDistance |
ZERO_DISTANCE
Zero distance.
|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN
Constructor and Description |
---|
FloatDistance()
Empty constructor for serialization purposes.
|
FloatDistance(float value)
Constructs a new FloatDistance object that represents the float argument.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(FloatDistance 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.
|
float |
floatValue()
Get the value as float.
|
FloatDistance |
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.
|
FloatDistance |
infiniteDistance()
An infinite FloatDistance is based on
Float.POSITIVE_INFINITY . |
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.
|
FloatDistance |
nullDistance()
A null FloatDistance is based on 0.
|
FloatDistance |
parseString(String val)
As pattern is required a String defining a Float.
|
void |
readExternal(ObjectInput in)
Reads the float value of this FloatDistance from the specified stream.
|
String |
toString()
Any implementing class should implement a proper toString-method for
printing the result-values.
|
FloatDistance |
undefinedDistance()
An undefined FloatDistance is based on
Float.NaN . |
void |
writeExternal(ObjectOutput out)
Writes the float value of this FloatDistance to the specified stream.
|
byteValue, intValue, shortValue
requiredInputPattern, testInputPattern
public static final FloatDistance FACTORY
private float value
private static final long serialVersionUID
public static final FloatDistance INFINITE_DISTANCE
public static final FloatDistance ZERO_DISTANCE
public static final FloatDistance UNDEFINED_DISTANCE
public FloatDistance()
public FloatDistance(float value)
value
- the value to be represented by the FloatDistance.public FloatDistance fromDouble(double val)
NumberDistance
fromDouble
in class NumberDistance<FloatDistance,Float>
val
- Valuepublic 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<FloatDistance,Float>
public float floatValue()
NumberDistance
floatValue
in class NumberDistance<FloatDistance,Float>
public long longValue()
NumberDistance
longValue
in class NumberDistance<FloatDistance,Float>
public int compareTo(FloatDistance other)
public FloatDistance infiniteDistance()
Float.POSITIVE_INFINITY
.public FloatDistance nullDistance()
public FloatDistance undefinedDistance()
Float.NaN
.public FloatDistance parseString(String val) throws IllegalArgumentException
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 boolean isInfiniteDistance()
Distance
isInfiniteDistance
in interface Distance<FloatDistance>
isInfiniteDistance
in class AbstractDistance<FloatDistance>
public boolean isNullDistance()
Distance
isNullDistance
in interface Distance<FloatDistance>
isNullDistance
in class AbstractDistance<FloatDistance>
public boolean isUndefinedDistance()
Distance
isUndefinedDistance
in interface Distance<FloatDistance>
isUndefinedDistance
in class AbstractDistance<FloatDistance>
public Pattern getPattern()
AbstractDistance
getPattern
in class AbstractDistance<FloatDistance>
public String toString()
Distance
toString
in interface Distance<FloatDistance>
toString
in class Object
public int hashCode()
AbstractDistance
hashCode
in class AbstractDistance<FloatDistance>
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<FloatDistance>