public int compareTo(Measurable<Duration> arg0) { double arg0InSecond = arg0.doubleValue(SECOND); return (_seconds > arg0InSecond) ? 1 : (_seconds < arg0InSecond) ? -1 : 0; }
if (obj instanceof Measurable) { Measurable measurable = (Measurable) obj; formatMeasurable(measurable.longValue(NonSI.BYTE), buff, multiplier); } else if (obj instanceof Number) { Number value = (Number) obj;
if (obj instanceof Measurable) { Measurable measurable = (Measurable) obj; long value = measurable.longValue(SI.SECOND.divide(1000)); value /= multiplier.getValue(); formatMeasurable(value, buff, multiplier);
public int compareTo(Measurable<Length> measure) { double meters = measure.doubleValue(METRE); return (_meters > meters) ? 1 : (_meters < meters) ? -1 : 0; }
public int compareTo(Measurable<Length> arg0) { double arg0InMeter = arg0.doubleValue(METRE); return (_meters > arg0InMeter) ? 1 : (_meters < arg0InMeter) ? -1 : 0; }
@Override protected LatLong coordinatesOf(AbsolutePosition position) { return LatLong.valueOf(position.latitudeWGS84.doubleValue(DEGREE_ANGLE), position.longitudeWGS84.doubleValue(DEGREE_ANGLE), DEGREE_ANGLE); }
@Override protected Altitude coordinatesOf(AbsolutePosition position) { return Altitude.valueOf(position.heightWGS84.doubleValue(METRE), METRE); }
@Override protected Height coordinatesOf(AbsolutePosition position) { if (position.heightWGS84 instanceof Height) return (Height) position.heightWGS84; return Height.valueOf(position.heightWGS84.doubleValue(METRE), METRE); }
@Override protected Time coordinatesOf(AbsolutePosition position) { if (position.timeUTC instanceof Time) return (Time) position.timeUTC; return Time.valueOf(position.timeUTC.doubleValue(SECOND), SECOND); }
/** * Compares this measure with the specified measurable object. * * @param that the measure to compare with. * @return a negative integer, zero, or a positive integer as this measure * is less than, equal to, or greater than that measurable. * @throws ConversionException if the current model does not allows for * these measure to be compared. */ @SuppressWarnings("unchecked") public int compareTo(Measurable<Q> that) { double thatValue = that.doubleValue(_unit); return Double.compare(this.getEstimatedValue(), thatValue); }
@Override protected XYZ coordinatesOf(AbsolutePosition position) { double latitude = position.latitudeWGS84.doubleValue(RADIAN); double longitude = position.longitudeWGS84.doubleValue(RADIAN); double height = (position.heightWGS84 != null) ? position.heightWGS84.doubleValue(METRE) : 0.0; double cosLat = Math.cos(latitude); double sinLat = Math.sin(latitude); double cosLon = Math.cos(longitude); double sinLon = Math.sin(longitude); double roc = WGS84.verticalRadiusOfCurvature(latitude); double x = (roc + height) * cosLat * cosLon; double y = (roc + height) * cosLat * sinLon; double z = ((1.0 - WGS84.getEccentricitySquared()) * roc + height) * sinLat; return XYZ.valueOf(x, y, z, METRE); }
@Override protected UTM coordinatesOf(AbsolutePosition position) { LatLong latLong = LatLong.valueOf(position.latitudeWGS84 .doubleValue(SI.RADIAN), position.longitudeWGS84 .doubleValue(SI.RADIAN), SI.RADIAN); // UTM or UPS? final double latitude = position.latitudeWGS84 .doubleValue(NonSI.DEGREE_ANGLE); if (latitude > SOUTHERN_LIMIT_IN_DEGREES && latitude < NORTHERN_LIMIT_IN_DEGREES) { return latLongToUtm(latLong, WGS84); } else { return latLongToUps(latLong, WGS84); } }
/** * Returns the <i>radius of curvature in the prime vertical</i> * for this reference ellipsoid at the specified latitude. * * @param latitude The local latitude. * @return The radius of curvature in the prime vertical. */ public Measurable<Length> verticalRadiusOfCurvature(final Measurable<Angle> latitude) { return Measure.valueOf(verticalRadiusOfCurvature(latitude.doubleValue(SI.RADIAN)), SI.METRE); }
/** * Returns the meridional arc, the true meridional distance on the * ellipsoid from the equator to the specified latitude. * * @param latitude The local latitude. * @return The meridional arc. */ public Measurable<Length> meridionalArc(final Measurable<Angle> latitude) { return Measure.valueOf(meridionalArc(latitude.doubleValue(SI.RADIAN)), SI.METRE); }
/** * Returns the <i>radius of curvature in the meridian<i> * for this reference ellipsoid at the specified latitude. * * @param latitude The local latitude (in radians). * @return The radius of curvature in the meridian (in meters). */ public Measurable<Length> meridionalRadiusOfCurvature(final Measurable<Angle> latitude) { return Measure.valueOf(meridionalRadiusOfCurvature(latitude.doubleValue(SI.RADIAN)), SI.METRE); }
/** * Compares this measure to the specified measurable quantity. * This method compares the {@link Measurable#doubleValue(Unit)} of * both this measure and the specified measurable stated in the * same unit (this measure's {@link #getUnit() unit}). * * @return a negative integer, zero, or a positive integer as this measure * is less than, equal to, or greater than the specified measurable * quantity. * @return <code>Double.compare(this.doubleValue(getUnit()), * that.doubleValue(getUnit()))</code> */ public int compareTo(Measurable<Q> that) { return java.lang.Double.compare(doubleValue(getUnit()), that .doubleValue(getUnit())); }
/** * Compares this measure to the specified measurable quantity. * This method compares the {@link Measurable#doubleValue(Unit)} of * both this measure and the specified measurable stated in the * same unit (this measure's {@link #getUnit() unit}). * * @return a negative integer, zero, or a positive integer as this measure * is less than, equal to, or greater than the specified measurable * quantity. * @return <code>Double.compare(this.doubleValue(getUnit()), * that.doubleValue(getUnit()))</code> */ public int compareTo(Measurable<Q> that) { return java.lang.Double.compare(doubleValue(getUnit()), that .doubleValue(getUnit())); }
/** * Compares this measure to the specified measurable quantity. * This method compares the {@link Measurable#doubleValue(Unit)} of * both this measure and the specified measurable stated in the * same unit (this measure's {@link #getUnit() unit}). * * @return a negative integer, zero, or a positive integer as this measure * is less than, equal to, or greater than the specified measurable * quantity. * @return <code>Double.compare(this.doubleValue(getUnit()), * that.doubleValue(getUnit()))</code> */ public int compareTo(Measurable<Q> that) { return java.lang.Double.compare(doubleValue(getUnit()), that .doubleValue(getUnit())); }
@Override protected AbsolutePosition positionOf(XYZ coordinates, AbsolutePosition position) { final double x = coordinates._x; final double y = coordinates._y; final double z = coordinates._z; final double longitude = Math.atan2(y, x); final double latitude; final double xy = Math.hypot(x, y); // conventional result if xy == 0.0... if (xy == 0.0) { latitude = (z >= 0.0) ? Math.PI / 2.0 : -Math.PI / 2.0; } else { final double a = WGS84.getSemimajorAxis().doubleValue(METRE); final double b = WGS84.getsSemiminorAxis().doubleValue(METRE); final double ea2 = WGS84.getEccentricitySquared(); final double eb2 = WGS84.getSecondEccentricitySquared(); final double beta = Math.atan2(a * z, b * xy); double numerator = z + b * eb2 * cube(Math.sin(beta)); double denominator = xy - a * ea2 * cube(Math.cos(beta)); latitude = Math.atan2(numerator, denominator); } final double height = xy / Math.cos(latitude) - WGS84.verticalRadiusOfCurvature(latitude); position.latitudeWGS84 = Measure.valueOf(latitude, RADIAN); position.longitudeWGS84 = Measure.valueOf(longitude, RADIAN); position.heightWGS84 = Measure.valueOf(height, METRE); return position; }
final double lambda = latLong.longitudeValue(RADIAN); final double a = ellipsoid.getSemimajorAxis().doubleValue(METRE); final double e = ellipsoid.getEccentricity(); final double e2 = ellipsoid.getEccentricitySquared();