/** * Extract the simple unit string (no number), eg "s" or "m". * @return unit string with no value */ public String getUnitString() { return uu.getDerivedUnit().toString(); }
/** * Extract the simple unit string (no number), eg "s" or "m". * @return unit string with no value */ public String getUnitString() { return uu.getDerivedUnit().toString(); }
/** * Extract the simple unit string (no number), eg "s" or "m". * @return unit string with no value */ public String getUnitString() { return uu.getDerivedUnit().toString(); }
/** * Constructs from a reference unit, and offset, and a unit identifier. * * @param unit * The reference unit. * @param offset * The origin of this unit in terms of the reference unit. For * example, a degree Celsius unit would be created as "<code>new * OffsetUnit(kelvin, 273.15)</code>. * @param id * The identifier for the new unit. */ public OffsetUnit(final Unit unit, final double offset, final UnitName id) { super(id); if (!(unit instanceof OffsetUnit)) { _unit = unit; _offset = offset; } else { _unit = ((OffsetUnit) unit)._unit; _offset = ((OffsetUnit) unit)._offset + offset; } _derivedUnit = _unit.getDerivedUnit(); }
/** * Constructs from a reference unit, and offset, and a unit identifier. * * @param unit * The reference unit. * @param offset * The origin of this unit in terms of the reference unit. For * example, a degree Celsius unit would be created as "<code>new * OffsetUnit(kelvin, 273.15)</code>. * @param id * The identifier for the new unit. */ public OffsetUnit(final Unit unit, final double offset, final UnitName id) { super(id); if (!(unit instanceof OffsetUnit)) { _unit = unit; _offset = offset; } else { _unit = ((OffsetUnit) unit)._unit; _offset = ((OffsetUnit) unit)._offset + offset; } _derivedUnit = _unit.getDerivedUnit(); }
/** * Gets the derived unit underlying this unit. * * @return The derived unit which underlies this unit. */ public DerivedUnit getDerivedUnit() { return getUnit().getDerivedUnit(); }
/** * Returns the derived unit underlying the reference time unit. * * @return The derived unit underlying the reference time unit. */ public DerivedUnit getDerivedUnit() { return getUnit().getDerivedUnit(); }
private boolean definedInternally(String unitName) { final Unit o = parseUnit(unitName); if (o == null || o instanceof UnknownUnit) return false; if (o.getDerivedUnit() instanceof UnknownUnit) return false; return true; }
/** * Gets the derived unit underlying this unit. * * @return The derived unit which underlies this unit. */ public DerivedUnit getDerivedUnit() { return getUnit().getDerivedUnit(); }
private boolean definedInternally(String unitName) { final Unit o = parseUnit(unitName); if (o == null || o instanceof UnknownUnit) return false; if (o.getDerivedUnit() instanceof UnknownUnit) return false; return true; }
/** * Returns the derived unit underlying the reference time unit. * * @return The derived unit underlying the reference time unit. */ public DerivedUnit getDerivedUnit() { return getUnit().getDerivedUnit(); }
private boolean definedInternally(String unitName) { final Unit o = parseUnit(unitName); if (o == null || o instanceof UnknownUnit) return false; if (o.getDerivedUnit() instanceof UnknownUnit) return false; return true; }
? 1 : Math.log(base); derivedUnit = reference.getDerivedUnit();
? 1 : Math.log(base); derivedUnit = reference.getDerivedUnit();
/** * Indicates if numeric values in this unit are convertible with another * unit. * * @param that * The other unit. * @return <code>true</code> if and only if numeric values in this unit are * convertible the other unit. */ public boolean isCompatible(final Unit that) { // jeffm: for some reason just calling getDerivedUnit().equals(...) // with jikes 1.1.7 as the compiler causes the jvm to crash. // The Unit u1=... does not crash. final Unit u1 = getDerivedUnit(); return u1.equals(that.getDerivedUnit()); // return getDerivedUnit().equals(that.getDerivedUnit()); }
/** * Indicates if values in this unit are convertible with another unit. * * @param that * The other unit. * @return <code>true</code> if and only if values in this unit are * convertible to values in <code> * that</code>. */ @Override public final boolean isCompatible(final Unit that) { final DerivedUnit unit = that.getDerivedUnit(); return equals(unit) || isReciprocalOf(unit); }
/** * Indicates if values in this unit are convertible with another unit. * * @param that * The other unit. * @return <code>true</code> if and only if values in this unit are * convertible to values in <code> * that</code>. */ @Override public final boolean isCompatible(final Unit that) { final DerivedUnit unit = that.getDerivedUnit(); return equals(unit) || isReciprocalOf(unit); }
/** * Indicates if numeric values in this unit are convertible with another * unit. * * @param that * The other unit. * @return <code>true</code> if and only if numeric values in this unit are * convertible the other unit. */ public boolean isCompatible(final Unit that) { // jeffm: for some reason just calling getDerivedUnit().equals(...) // with jikes 1.1.7 as the compiler causes the jvm to crash. // The Unit u1=... does not crash. final Unit u1 = getDerivedUnit(); return u1.equals(that.getDerivedUnit()); // return getDerivedUnit().equals(that.getDerivedUnit()); }