示例#1
0
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Measurement)) {
      return false;
    }

    Measurement that = (Measurement) o;

    double lhs =
        RoundToTwoDecimalPlaces.RoundOff(that.value * that.ConversionFactorToFoot(), roundOff);
    double rhs =
        RoundToTwoDecimalPlaces.RoundOff(this.value * this.ConversionFactorToFoot(), roundOff);
    return Double.compare(lhs, rhs) == 0;
  }
示例#2
0
 public Measurement Add(Measurement rhs) {
   double sumInFoot = value * ConversionFactorToFoot() + rhs.value * rhs.ConversionFactorToFoot();
   return new Measurement(RoundToTwoDecimalPlaces.RoundOff(sumInFoot, roundOff), Unit.foot);
 }