/** * Indicates if this transformed unit is considered equals to the specified * object (both are transformed units with equal parent unit and equal * converter to parent unit). * * @param that the object to compare for equality. * @return <code>true</code> if <code>this</code> and <code>that</code> * are considered equals; <code>false</code>otherwise. */ public boolean equals(Object that) { if (this == that) return true; if (!(that instanceof TransformedUnit)) return false; TransformedUnit<?> thatUnit = (TransformedUnit<?>) that; return this._parentUnit.equals(thatUnit._parentUnit) && this._toParentUnit.equals(thatUnit._toParentUnit); }
/** * Indicates if this transformed unit is considered equals to the specified * object (both are transformed units with equal parent unit and equal * converter to parent unit). * * @param that the object to compare for equality. * @return <code>true</code> if <code>this</code> and <code>that</code> * are considered equals; <code>false</code>otherwise. */ public boolean equals(Object that) { if (this == that) return true; if (!(that instanceof TransformedUnit)) return false; TransformedUnit<?> thatUnit = (TransformedUnit<?>) that; return this._parentUnit.equals(thatUnit._parentUnit) && this._toParentUnit.equals(thatUnit._toParentUnit); }
/** * Indicates if this transformed unit is considered equals to the specified * object (both are transformed units with equal parent unit and equal * converter to parent unit). * * @param that the object to compare for equality. * @return <code>true</code> if <code>this</code> and <code>that</code> * are considered equals; <code>false</code>otherwise. */ public boolean equals(Object that) { if (this == that) return true; if (!(that instanceof TransformedUnit)) return false; TransformedUnit<?> thatUnit = (TransformedUnit<?>) that; return this._parentUnit.equals(thatUnit._parentUnit) && this._toParentUnit.equals(thatUnit._toParentUnit); }
private static boolean areFunctionallyIdenticalUnits(Unit<?> left, Unit<?> right) { if (!left.isCompatible(right)) { return false; } Unit<?> divided = left.divide(right); if (!divided.getDimension().equals(javax.measure.unit.Dimension.NONE)) { return false; } return divided.asType(Dimensionless.class).getConverterTo(Unit.ONE).equals( UnitConverter.IDENTITY); }
if (converter.equals(UnitConverter.IDENTITY)) { return new MeasurementRange<N>(type, this, targetUnits);