public final class Length extends Object implements Serializable, Comparable<Length>
LinearUnit.| Constructor and Description |
|---|
Length(double value,
LinearUnit unit)
Create a
Length object with ComputationType.SPHERICAL computation type. |
Length(double value,
LinearUnit unit,
ComputationType ct)
Create a
Length object with the specified ComputationType computation type. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Length length)
Compare this legnth to another.
|
static Angle |
convert(Length length)
Returns the specified
Length into an comparable Angle. |
static Length |
convert(Length length,
LinearUnit unit)
Returns the specified
Length converted from its LinearUnit to the specified
LinearUnit. |
boolean |
equals(Object o)
Equals implementation.
|
boolean |
equivalent(Length length)
Returns
true if the specified Length is equivalent to this Length. |
boolean |
equivalent(Length length,
double tolerance)
Returns
true if the specified Length is equivalent to this Length. |
ComputationType |
getComputationType()
Returns the computation type used to interpret geometry coordinates when doing the length computations.
|
LinearUnit |
getUnit()
Returns the unit of measure for this length.
|
double |
getValue()
Returns the value of measure for this length.
|
double |
getValue(LinearUnit unit)
Returns the length in the requested unit, converting if necessary.
|
int |
hashCode()
Hashcode implementation.
|
String |
toString() |
public Length(double value,
LinearUnit unit)
Length object with ComputationType.SPHERICAL computation type.value - the value of measure for this length.unit - the unit of measure for this length.IllegalArgumentException - if the specified unit is null.public Length(double value,
LinearUnit unit,
ComputationType ct)
Length object with the specified ComputationType computation type.value - the value of measure for this length.unit - the unit of measure for this length.IllegalArgumentException - if the specified unit is null.public LinearUnit getUnit()
public double getValue()
public ComputationType getComputationType()
public double getValue(LinearUnit unit)
unit - the desired unit.IllegalArgumentException - if the specified unit is null.public boolean equivalent(Length length)
true if the specified Length is equivalent to this Length. Same as
calling Length.equivalent(Length, double).length - length to test for equivalence.public boolean equivalent(Length length, double tolerance)
true if the specified Length is equivalent to this Length.
Two Lengths are equivalent if they represent the same absolute distance, e.g. Length 1000 meters is
equivalent to Length 1 kilometer.
This method has the same behavior as calling Length.equivalent(Length,double) with tolerance == 0;length - length to test for equivalence.public static Angle convert(Length length)
Length into an comparable Angle.
Note: this method treats the input length as a measure along a Great Circle of the earth and uses the conversion
constant: 1 Great Circle degree = 111194.87428 meter
The meaning of the input length determines whether this conversion produces a reasonable result.length - an lengthpublic boolean equals(Object o)
public int hashCode()
public static Length convert(Length length, LinearUnit unit)
Length converted from its LinearUnit to the specified
LinearUnit. If the LinearUnit of the specified Length is the same as the
specified LinearUnit to convert to then the specified length is returned.length - The Length to convert.unit - The unit to convert the specified Length to.public int compareTo(Length length)
compareTo in interface Comparable<Length>