/** * Indicates if this unit is dimensionless. A ScaledUnit is dimensionless if * and only if the reference unit is dimensionless. * * @return <code>true</code> if and only if this unit is dimensionless. */ public boolean isDimensionless() { return getUnit().isDimensionless(); }
/** * Indicates if this unit is dimensionless. * * @return <code>true</code> if and only if this unit is dimensionless. */ public boolean isDimensionless() { return getUnit().isDimensionless(); }
/** * Indicates if this unit is dimensionless. A ScaledUnit is dimensionless if * and only if the reference unit is dimensionless. * * @return <code>true</code> if and only if this unit is dimensionless. */ public boolean isDimensionless() { return getUnit().isDimensionless(); }
/** * Indicates if this unit is dimensionless. * * @return <code>true</code> if and only if this unit is dimensionless. */ public boolean isDimensionless() { return getUnit().isDimensionless(); }
/** * Multiply this unit by another unit. * * @param that * The unit to multiply this unit by. Must be dimensionless. * @return The product of this unit and <code>that</code>. * @throws MultiplyException * Can't multiply these units together. */ @Override protected Unit myMultiplyBy(final Unit that) throws MultiplyException { if (!that.isDimensionless()) { throw new MultiplyException(that); } return that instanceof ScaledUnit ? new ScaledUnit(((ScaledUnit) that).getScale(), this) : this; }
/** * Divide this unit by another unit. * * @param that * The unit to divide this unit by. * @return The quotient of this unit and <code>that</code>. * @throws DivideException * Can't divide these units. */ @Override protected Unit myDivideBy(final Unit that) throws DivideException { if (!that.isDimensionless()) { throw new DivideException(that); } return that instanceof ScaledUnit ? new ScaledUnit(1.0 / ((ScaledUnit) that).getScale(), this) : this; }
/** * Multiply this unit by another unit. * * @param that * The unit to multiply this unit by. Must be dimensionless. * @return The product of this unit and <code>that</code>. * @throws MultiplyException * Can't multiply these units together. */ @Override protected Unit myMultiplyBy(final Unit that) throws MultiplyException { if (!that.isDimensionless()) { throw new MultiplyException(that); } return that instanceof ScaledUnit ? new ScaledUnit(((ScaledUnit) that).getScale(), this) : this; }
/** * Divide this unit by another unit. * * @param that * The unit to divide this unit by. * @return The quotient of this unit and <code>that</code>. * @throws DivideException * Can't divide these units. */ @Override protected Unit myDivideBy(final Unit that) throws DivideException { if (!that.isDimensionless()) { throw new DivideException(that); } return that instanceof ScaledUnit ? new ScaledUnit(1.0 / ((ScaledUnit) that).getScale(), this) : this; }
System.out.println("sPerS = \"" + sPerS + '"'); System.out .println("sPerS.isDimensionless()=" + sPerS.isDimensionless()); meterPerSecond.raiseTo(2); meter.myDivideBy(meterPerSecond);
System.out.println("sPerS = \"" + sPerS + '"'); System.out .println("sPerS.isDimensionless()=" + sPerS.isDimensionless()); meterPerSecond.raiseTo(2); meter.myDivideBy(meterPerSecond);