Example #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);
  }
Example #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);
  }
Example #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);
  }
Example #4
0
 /** "greater than or equal" comparison. */
 public boolean gte(final Unit<T> otherUnit) {
   return this.getRawValue() >= otherUnit.getRawValue();
 }
Example #5
0
 /** "less than" comparison. */
 public boolean lt(final Unit<T> otherUnit) {
   return this.getRawValue() < otherUnit.getRawValue();
 }