public class Distance extends Object implements Serializable
Constructor and Description |
---|
Distance(double value)
Creates a new
Distance with a neutral metric. |
Distance(double value,
Metric metric)
|
Modifier and Type | Method and Description |
---|---|
Distance |
add(Distance other)
Adds the given distance to the current one.
|
Distance |
add(Distance other,
Metric metric)
|
boolean |
equals(Object obj) |
Metric |
getMetric()
|
double |
getNormalizedValue()
Returns the normalized value regarding the underlying
Metric . |
double |
getValue()
Returns the distance value in the current
Metric . |
int |
hashCode() |
Distance |
in(Metric metric)
|
String |
toString() |
public Distance(double value)
Distance
with a neutral metric. This means the provided value needs to be in normalized form.value
- public Distance(double value, Metric metric)
value
- metric
- can be null.public double getValue()
Metric
.public double getNormalizedValue()
Metric
.public Metric getMetric()
public Distance add(Distance other)
Distance
will be in the same metric as the
current one.other
- must not be null.public Distance add(Distance other, Metric metric)
other
- must not be null.metric
- must not be null.public Distance in(Metric metric)
Distance
in the given Metric
. This means that the returned instance will have the
same normalized value as the original instance.metric
- must not be null.Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.