コード例 #1
0
ファイル: Unit.java プロジェクト: yuSniper/SweetBlue
  /** 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);
  }
コード例 #2
0
ファイル: Unit.java プロジェクト: yuSniper/SweetBlue
  /** 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);
  }
コード例 #3
0
ファイル: Unit.java プロジェクト: yuSniper/SweetBlue
  /** 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);
  }
コード例 #4
0
ファイル: Unit.java プロジェクト: yuSniper/SweetBlue
 /** "greater than or equal" comparison. */
 public boolean gte(final Unit<T> otherUnit) {
   return this.getRawValue() >= otherUnit.getRawValue();
 }
コード例 #5
0
ファイル: Unit.java プロジェクト: yuSniper/SweetBlue
 /** "less than" comparison. */
 public boolean lt(final Unit<T> otherUnit) {
   return this.getRawValue() < otherUnit.getRawValue();
 }