/** * Constructor. */ public StandardUnitFormat(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new StandardUnitFormatTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 36; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
private boolean isUnknownUnit(ucar.units.DerivedUnit du) { UnitDimension dim = du.getDimension(); for (Factor f : dim.getFactors()) { if (f.getBase() instanceof ucar.units.UnknownUnit) return true; } return false; }
@Override public Unit multiplyBy(final double scale) throws MultiplyException { if (scale == 0) { throw new MultiplyException(scale, this); } return getInstance(_unit.multiplyBy(scale), _offset / scale); }
/** * Indicates if a unit is a time unit. * * @param unit The unit in question. * @return {@code true} if and only if {@code unit} is a time unit. * @Throws UnitSystemException if the unit system can't be initialized. */ private static boolean isTimeUnit(final Unit unit) throws UnitSystemException { return unit.isCompatible(UnitSystemManager.instance().getBaseUnit( BaseQuantity.TIME)); }
/** * Indicates if this Factor is the reciprocal of another Factor. * * @param that * The other factor. * @return <code>true</code> if and only if this Factor is the reciprocal of * <code>that</code>. */ public boolean isReciprocalOf(final Factor that) { return getBase().equals(that.getBase()) && getExponent() == -that.getExponent(); }
/** * Indicates if this factor is dimensionless. A Factor is dimensionless if * and only if the exponent is zero or the Base entity is dimensionless. * * @return <code>true</code> if and only if this Factor is dimensionless. */ public boolean isDimensionless() { return getExponent() == 0 || getBase().isDimensionless(); } }
/** * Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 36; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** * Indicates if this derived unit is the reciprocal of another derived unit * (e.g. "second" and "hertz"). * * @param that * The other, derived unit. */ public final boolean isReciprocalOf(final DerivedUnit that) { return dimension.isReciprocalOf(that.getDimension()); }
/** * Gets a prefix from the prefix database. */ private static Prefix getPrefix(String string) throws PrefixDBException { PrefixDB prefixDB = PrefixDBManager.instance(); Prefix prefix = prefixDB.getPrefixByName(string); if (prefix == null) prefix = prefixDB.getPrefixBySymbol(string); return prefix; }
static Unit getInstance(final double scale, final Unit unit) throws MultiplyException { if (scale == 0) { throw new MultiplyException(scale, unit); } return scale == 1 ? unit : new ScaledUnit(scale, unit); }
/** * Factory method for constructing a derived unit. * * @param name The name of the unit. * @param symbol The symbol for the unit. * @param definition The definition of the unit. * @return The derived unit corresponding to the arguments. */ private static Unit du(final String name, final String symbol, final Unit definition) throws NameException { return definition.clone(UnitName.newUnitName(name, null, symbol)); }
/** * Returns the quantity dimension of this derived unit. * * @return The quantity dimension of this derived unit. */ public final QuantityDimension getQuantityDimension() { return getDimension().getQuantityDimension(); }
private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } private int jjMoveNfa_0(int startState, int curPos)
/** * Returns the string representation of this unit. * * @return The string representation of this unit. */ @Override public String toString() { final String string = super.toString(); // get symbol or name return string != null ? string : getCanonicalString(); }
private boolean isUnknownUnit(ucar.units.DerivedUnit du) { UnitDimension dim = du.getDimension(); for (Factor f : dim.getFactors()) { if (f.getBase() instanceof ucar.units.UnknownUnit) return true; } return false; }
/** * Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 36; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
@Override public Unit multiplyBy(final double scale) throws MultiplyException { if (scale == 0) { throw new MultiplyException(scale, this); } return getInstance(_unit.multiplyBy(scale), _offset / scale); }
private boolean isUnknownUnit(ucar.units.DerivedUnit du) { UnitDimension dim = du.getDimension(); for (Factor f : dim.getFactors()) { if (f.getBase() instanceof ucar.units.UnknownUnit) return true; } return false; }