congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ucar.units
Code IndexAdd Tabnine to your IDE (free)

How to use ucar.units

Best Java code snippets using ucar.units (Showing top 20 results out of 315)

origin: org.lasersonlab.thredds/udunits

/**
 * 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();
}
origin: edu.ucar/netcdf

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;
}
origin: org.lasersonlab.thredds/udunits

@Override
public Unit multiplyBy(final double scale) throws MultiplyException {
  if (scale == 0) {
    throw new MultiplyException(scale, this);
  }
  return getInstance(_unit.multiplyBy(scale), _offset / scale);
}
origin: org.lasersonlab.thredds/udunits

/**
 * 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));
}
origin: edu.ucar/udunits

/**
 * 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();
}
origin: edu.ucar/udunits

  /**
   * 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();
  }
}
origin: edu.ucar/udunits

/**
 * 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();
}
origin: edu.ucar/udunits

/**
 * 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());
}
origin: edu.ucar/udunits

/**
 * 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;
}
origin: edu.ucar/udunits

/**
 * Constructor with generated Token Manager.
 */
public StandardUnitFormat(StandardUnitFormatTokenManager tm) {
 token_source = tm;
 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();
}
origin: edu.ucar/udunits

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);
}
origin: org.lasersonlab.thredds/udunits

/**
 * 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));
}
origin: org.lasersonlab.thredds/udunits

/**
 * Returns the quantity dimension of this derived unit.
 * 
 * @return The quantity dimension of this derived unit.
 */
public final QuantityDimension getQuantityDimension() {
  return getDimension().getQuantityDimension();
}
origin: org.lasersonlab.thredds/udunits

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)
origin: org.lasersonlab.thredds/udunits

/**
 * 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();
}
origin: edu.ucar/cdm

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;
}
origin: org.lasersonlab.thredds/udunits

/**
 * 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();
}
origin: edu.ucar/udunits

@Override
public Unit multiplyBy(final double scale) throws MultiplyException {
  if (scale == 0) {
    throw new MultiplyException(scale, this);
  }
  return getInstance(_unit.multiplyBy(scale), _offset / scale);
}
origin: org.lasersonlab.thredds/udunits

/**
 * Reinitialise.
 */
public void ReInit(StandardUnitFormatTokenManager tm) {
 token_source = tm;
 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();
}
origin: Unidata/thredds

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;
}
ucar.units

Most used classes

  • Unit
    Interface for units.
  • UnitFormat
    Interface for classes that parse and format unit specifications.
  • ScaledUnit
    Provides support for a unit that is a mutiplicative factor of a reference unit. Instances of this cl
  • TimeScaleUnit
    Provides support for a reference time unit whose origin is at a certain time. Instances of this cla
  • UnitFormatManager
    Provides support for managing a default UnitFormat.
  • Converter,
  • DerivedUnit,
  • Factor,
  • UnitDimension,
  • StandardUnitFormat,
  • BaseUnit,
  • NoSuchUnitException,
  • PrefixDBException,
  • SpecificationException,
  • UnitDBException,
  • UnitException,
  • UnitName,
  • UnitParseException,
  • UnitSystemException
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now