public final class Weight extends Object implements Serializable
| Constructor and Description |
|---|
Weight(double value,
com.pb.routing.unit.WeightUnit unit)
Creates a Weight instance with the specified value and unit.
|
| Modifier and Type | Method and Description |
|---|---|
Weight |
convertTo(com.pb.routing.unit.WeightUnit unit)
Returns a Weight that is this weight converted to the specified WeightUnit.
|
boolean |
equals(Object o) |
boolean |
equivalent(Weight weight)
Returns true if the specified Weight is equivalent to this Weight.
|
boolean |
equivalent(Weight weight,
double tolerance)
Returns true if the specified Weight is equivalent within the specified tolerance to this Weight.
|
com.pb.routing.unit.WeightUnit |
getUnit()
Returns the units of weight.
|
double |
getValue()
Returns the amount of weight.
|
double |
getValue(com.pb.routing.unit.WeightUnit unit)
Returns the value of this weight converted to the specified unit.
|
int |
hashCode() |
boolean |
isGreaterThan(Weight weight)
Returns
true if the specified Weight is less than this Weight; else false. |
String |
toString() |
public Weight(double value,
com.pb.routing.unit.WeightUnit unit)
value - the amount of weight.unit - the unit of the weight.public double getValue()
public double getValue(com.pb.routing.unit.WeightUnit unit)
unit - the unit to convert this Weight's value to.public com.pb.routing.unit.WeightUnit getUnit()
public Weight convertTo(com.pb.routing.unit.WeightUnit unit)
unit - the unit to convert this Weight to.public boolean isGreaterThan(Weight weight)
true if the specified Weight is less than this Weight; else false.weight - the Weight to check for greatness.true if the specified Weight is less than this Weight; else false.public boolean equivalent(Weight weight)
weight - the Weight to check for equivalence.public boolean equivalent(Weight weight, double tolerance)
weight - the Weight to check for equivalence.tolerance - the tolerance of acceptable equivalence.