/** * Divide this unit into another unit. * * @param that * The unit to divide this unit into. * @return The quotient of <code>that</code> unit and this unit. The offset * of this unit will be ignored; thus, for example * "celsius.myDivideInto(day)" is equivalent to * "kelvin.myDivideInto(day)". * @throws OperationException * Can't divide these units. */ @Override protected Unit myDivideInto(final Unit that) throws OperationException { return that instanceof OffsetUnit ? getUnit().divideInto(((OffsetUnit) that).getUnit()) : getUnit().divideInto(that); }
/** * Divide this unit into another unit. * * @param that * The unit to divide this unit into. * @return The quotient of <code>that</code> unit and this unit. The offset * of this unit will be ignored; thus, for example * "celsius.myDivideInto(day)" is equivalent to * "kelvin.myDivideInto(day)". * @throws OperationException * Can't divide these units. */ @Override protected Unit myDivideInto(final Unit that) throws OperationException { return that instanceof OffsetUnit ? getUnit().divideInto(((OffsetUnit) that).getUnit()) : getUnit().divideInto(that); }
/** * Divides this unit into another unit. * * @param that * The other unit. * @return The quotient of this unit divided into the other unit. * @throws OperationException * Can't divide these units. */ @Override protected Unit myDivideInto(final Unit that) throws OperationException { return that instanceof ScaledUnit ? new ScaledUnit(((ScaledUnit) that).getScale() / getScale(), getUnit().divideInto(((ScaledUnit) that).getUnit())) : new ScaledUnit(1 / getScale(), getUnit().divideInto(that)); }
/** * Divides this unit into another unit. * * @param that * The other unit. * @return The quotient of this unit divided into the other unit. * @throws OperationException * Can't divide these units. */ @Override protected Unit myDivideInto(final Unit that) throws OperationException { return that instanceof ScaledUnit ? new ScaledUnit(((ScaledUnit) that).getScale() / getScale(), getUnit().divideInto(((ScaledUnit) that).getUnit())) : new ScaledUnit(1 / getScale(), getUnit().divideInto(that)); }
/** * Divides this derived unit by another. * * @param that * The other unit. * @return The quotient of the two units. * @throws OperationException * Can't divide these units. */ @Override protected Unit myDivideBy(final Unit that) throws OperationException { Unit result; if (dimension.getRank() == 0) { result = that.raiseTo(-1); } else { if (!(that instanceof DerivedUnit)) { result = that.divideInto(this); } else { final UnitDimension thatDimension = ((DerivedUnit) that) .getDimension(); result = thatDimension.getRank() == 0 ? this : new DerivedUnitImpl(dimension.divideBy(thatDimension)); } } return result; }
/** * Divides this derived unit by another. * * @param that * The other unit. * @return The quotient of the two units. * @throws OperationException * Can't divide these units. */ @Override protected Unit myDivideBy(final Unit that) throws OperationException { Unit result; if (dimension.getRank() == 0) { result = that.raiseTo(-1); } else { if (!(that instanceof DerivedUnit)) { result = that.divideInto(this); } else { final UnitDimension thatDimension = ((DerivedUnit) that) .getDimension(); result = thatDimension.getRank() == 0 ? this : new DerivedUnitImpl(dimension.divideBy(thatDimension)); } } return result; }