Esempio n. 1
0
  /** Returns a new instance that is the result of doing <code>this / other</code>. */
  public Unit<T> dividedBy(Unit<T> other) {
    if (other == null) return newInstance(Double.POSITIVE_INFINITY);

    final double result_raw = this.getRawValue() / other.getRawValue();

    return newInstance(result_raw);
  }
Esempio n. 2
0
  /** Returns a new instance that is the result of doing <code>this * other</code>. */
  public Unit<T> times(Unit<T> other) {
    if (other == null) return newInstance(0.0);

    final double result_raw = this.getRawValue() * other.getRawValue();

    return newInstance(result_raw);
  }
Esempio n. 3
0
  /** Returns a new instance that is the result of doing <code>this + other</code>. */
  public Unit<T> plus(Unit<T> other) {
    if (other == null) return this;

    final double result_raw = this.getRawValue() + other.getRawValue();

    return newInstance(result_raw);
  }
Esempio n. 4
0
 /** "greater than or equal" comparison. */
 public boolean gte(final Unit<T> otherUnit) {
   return this.getRawValue() >= otherUnit.getRawValue();
 }
Esempio n. 5
0
 /** "less than" comparison. */
 public boolean lt(final Unit<T> otherUnit) {
   return this.getRawValue() < otherUnit.getRawValue();
 }