|
|
|||||||||
| 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<FloatDistance,Float>
de.lmu.ifi.dbs.elki.distance.distancevalue.FloatDistance
public class FloatDistance

Provides a Distance for a float-valued distance.
| Field Summary | |
|---|---|
static FloatDistance |
FACTORY
The static factory instance |
private static long |
serialVersionUID
Generated serialVersionUID. |
private float |
value
The distance value. |
| Fields inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance |
|---|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN |
| Constructor Summary | |
|---|---|
FloatDistance()
Empty constructor for serialization purposes. |
|
FloatDistance(float value)
Constructs a new FloatDistance object that represents the float argument. |
|
| Method Summary | |
|---|---|
int |
compareTo(FloatDistance 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. |
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 |
Float |
getValue()
Returns the value of this NumberDistance. |
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 |
minus(FloatDistance distance)
Returns a new Distance by subtracting the given distance from this distance. |
FloatDistance |
nullDistance()
A null FloatDistance is based on 0. |
FloatDistance |
parseString(String val)
As pattern is required a String defining a Float. |
FloatDistance |
plus(FloatDistance distance)
Returns a new distance as sum of this distance and the given distance. |
void |
readExternal(ObjectInput in)
Reads the float value of this FloatDistance from the specified stream. |
(package private) void |
setValue(Float value)
Sets the value of this NumberDistance. |
FloatDistance |
times(float lambda)
Returns a new distance as the product of this distance and the given float value. |
FloatDistance |
times(FloatDistance distance)
Returns a new distance as the product of this distance and the given distance. |
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. |
| Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance |
|---|
byteValue, hashCode, intValue, 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 FloatDistance FACTORY
private float value
private static final long serialVersionUID
| Constructor Detail |
|---|
public FloatDistance()
public FloatDistance(float value)
value - the value to be represented by the FloatDistance.| Method Detail |
|---|
public FloatDistance fromDouble(double val)
NumberDistance
fromDouble in class NumberDistance<FloatDistance,Float>val - Value
public FloatDistance plus(FloatDistance distance)
Distance
distance - the distance to be added to this distance
public FloatDistance minus(FloatDistance distance)
Distance
distance - the distance to be subtracted from this distance
public FloatDistance times(FloatDistance distance)
distance - the distance to be multiplied with this distance
public FloatDistance times(float lambda)
lambda - the float value this distance should be multiplied with
public void writeExternal(ObjectOutput out)
throws IOException
IOException
public void readExternal(ObjectInput in)
throws IOException
IOExceptionpublic int externalizableSize()
public Float getValue()
NumberDistance
getValue in class NumberDistance<FloatDistance,Float>void setValue(Float value)
NumberDistance
setValue in class NumberDistance<FloatDistance,Float>value - the value to be setpublic 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)
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<FloatDistance>compareTo in class NumberDistance<FloatDistance,Float>other - Other object
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
function
IllegalArgumentException - 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>
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||