public class ScalarWeight extends Object implements Weight
Modifier and Type | Field and Description |
---|---|
static ScalarWeight |
NON_VIABLE_WEIGHT
Instance of scalar weight to mark links/paths which
can not be traversed.
|
Constructor and Description |
---|
ScalarWeight(double value)
Creates a new scalar weight with the given double value.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Weight otherWeight) |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isNegative()
Returns true if the weight is negative (means that aggregated
path cost will decrease if we add weighted subject to it).
|
boolean |
isViable()
Returns true if the weighted subject (link/path) can be traversed; false otherwise.
|
Weight |
merge(Weight otherWeight)
Merges the given weight with this one returning a new aggregated
weight.
|
static double |
samenessThreshold()
Returns the current sameness threshold for comparing cost values.
|
static void |
setSamenessThreshold(double threshold)
Sets a new sameness threshold for comparing cost values; default is
is
Double.MIN_VALUE . |
Weight |
subtract(Weight otherWeight)
Subtracts the given weight from this one and produces a new weight.
|
String |
toString() |
static ScalarWeight |
toWeight(double value)
Creates a new scalar weight with the given double value.
|
double |
value()
Returns inner double value.
|
public static final ScalarWeight NON_VIABLE_WEIGHT
public ScalarWeight(double value)
value
- double valuepublic static ScalarWeight toWeight(double value)
value
- double valuepublic Weight merge(Weight otherWeight)
Weight
public Weight subtract(Weight otherWeight)
Weight
public boolean isViable()
Weight
public int compareTo(Weight otherWeight)
compareTo
in interface Comparable<Weight>
public boolean isNegative()
Weight
isNegative
in interface Weight
public double value()
public static void setSamenessThreshold(double threshold)
Double.MIN_VALUE
.threshold
- fractional double valuepublic static double samenessThreshold()