Codota Logo
ScaledUnit.getUnit
Code IndexAdd Codota to your IDE (free)

How to use
getUnit
method
in
ucar.units.ScaledUnit

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

  • Common ways to obtain ScaledUnit
private void myMethod () {
ScaledUnit s =
  • Codota IconUnit unit;(ucar.units.ScaledUnit) unit
  • Smart code suggestions by Codota
}
origin: edu.ucar/udunits

/**
 * Clones this unit, changing the identifier.
 * 
 * @param id
 *            The new identifier.
 * @return A ScaledUnit with the new identifier.
 */
public Unit clone(final UnitName id) {
  return new ScaledUnit(_scale, getUnit(), id);
}
origin: edu.ucar/udunits

/**
 * Gets the derived unit underlying this unit.
 * 
 * @return The derived unit which underlies this unit.
 */
public DerivedUnit getDerivedUnit() {
  return getUnit().getDerivedUnit();
}
origin: edu.ucar/udunits

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

/**
 * Clones this unit, changing the identifier.
 * 
 * @param id
 *            The new identifier.
 * @return A ScaledUnit with the new identifier.
 */
public Unit clone(final UnitName id) {
  return new ScaledUnit(_scale, getUnit(), id);
}
origin: org.lasersonlab.thredds/udunits

/**
 * Gets the derived unit underlying this unit.
 * 
 * @return The derived unit which underlies this unit.
 */
public DerivedUnit getDerivedUnit() {
  return getUnit().getDerivedUnit();
}
origin: org.lasersonlab.thredds/udunits

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

/**
  * Returns the hash code of this instance.
  * 
  * @return The hash code of this instance.
  */
 @Override
 public int hashCode() {
   return (getScale() == 1
       ? 0
       : Double.valueOf(getScale()).hashCode()) ^ getUnit().hashCode();
 }
origin: edu.ucar/udunits

/**
  * Returns the hash code of this instance.
  * 
  * @return The hash code of this instance.
  */
 @Override
 public int hashCode() {
   return (getScale() == 1
       ? 0
       : Double.valueOf(getScale()).hashCode()) ^ getUnit().hashCode();
 }
origin: org.lasersonlab.thredds/udunits

private StringBuffer
format(ScaledUnit unit, StringBuffer buf, boolean normalize)
    throws UnitClassException {
 double scale = unit.getScale();
 if (scale != 0.0) {
  if (scale == 1) {
   format(unit.getUnit(), buf, normalize);
  } else {
   buf.append(scale).append(' ');
   int start = buf.length();
   format(unit.getUnit(), buf, normalize);
   if (start == buf.length())
    buf.setLength(start - 1);
  }
 }
 return buf;
}
origin: edu.ucar/udunits

private StringBuffer
format(ScaledUnit unit, StringBuffer buf, boolean normalize)
    throws UnitClassException {
 double scale = unit.getScale();
 if (scale != 0.0) {
  if (scale == 1) {
   format(unit.getUnit(), buf, normalize);
  } else {
   buf.append(scale).append(' ');
   int start = buf.length();
   format(unit.getUnit(), buf, normalize);
   if (start == buf.length())
    buf.setLength(start - 1);
  }
 }
 return buf;
}
origin: edu.ucar/udunits

/**
 * Raises this unit to a power.
 * 
 * @param power
 *            The power.
 * @return The result of raising this unit to the power.
 * @throws RaiseException
 *             Can't raise this unit to a power.
 */
@Override
protected Unit myRaiseTo(final int power) throws RaiseException {
  return new ScaledUnit(Math.pow(getScale(), power), getUnit().raiseTo(
      power));
}
origin: edu.ucar/udunits

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

/**
 * Raises this unit to a power.
 * 
 * @param power
 *            The power.
 * @return The result of raising this unit to the power.
 * @throws RaiseException
 *             Can't raise this unit to a power.
 */
@Override
protected Unit myRaiseTo(final int power) throws RaiseException {
  return new ScaledUnit(Math.pow(getScale(), power), getUnit().raiseTo(
      power));
}
origin: edu.ucar/udunits

/**
 * Multiplies this unit by another unit.
 * 
 * @param that
 *            The other unit.
 * @return The product of this unit and the other unit.
 * @throws MultiplyException
 *             Can't multiply these units together.
 */
@Override
protected Unit myMultiplyBy(final Unit that) throws MultiplyException {
  return that instanceof ScaledUnit
      ? new ScaledUnit(getScale() * ((ScaledUnit) that).getScale(),
          getUnit().multiplyBy(((ScaledUnit) that).getUnit()))
      : new ScaledUnit(getScale(), getUnit().multiplyBy(that));
}
origin: org.lasersonlab.thredds/udunits

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

/**
 * Multiplies this unit by another unit.
 * 
 * @param that
 *            The other unit.
 * @return The product of this unit and the other unit.
 * @throws MultiplyException
 *             Can't multiply these units together.
 */
@Override
protected Unit myMultiplyBy(final Unit that) throws MultiplyException {
  return that instanceof ScaledUnit
      ? new ScaledUnit(getScale() * ((ScaledUnit) that).getScale(),
          getUnit().multiplyBy(((ScaledUnit) that).getUnit()))
      : new ScaledUnit(getScale(), getUnit().multiplyBy(that));
}
origin: edu.ucar/udunits

/**
 * Divides this unit by another unit.
 * 
 * @param that
 *            The other unit.
 * @return The quotient of this unit divided by the other unit.
 * @throws OperationException
 *             Can't divide these units.
 */
@Override
protected Unit myDivideBy(final Unit that) throws OperationException {
  return that instanceof ScaledUnit
      ? new ScaledUnit(getScale() / ((ScaledUnit) that).getScale(),
          getUnit().divideBy(((ScaledUnit) that).getUnit()))
      : new ScaledUnit(getScale(), getUnit().divideBy(that));
}
origin: org.lasersonlab.thredds/udunits

/**
 * Divides this unit by another unit.
 * 
 * @param that
 *            The other unit.
 * @return The quotient of this unit divided by the other unit.
 * @throws OperationException
 *             Can't divide these units.
 */
@Override
protected Unit myDivideBy(final Unit that) throws OperationException {
  return that instanceof ScaledUnit
      ? new ScaledUnit(getScale() / ((ScaledUnit) that).getScale(),
          getUnit().divideBy(((ScaledUnit) that).getUnit()))
      : new ScaledUnit(getScale(), getUnit().divideBy(that));
}
origin: edu.ucar/udunits

/**
 * Converts a numeric value from the underlying derived unit to this unit.
 * 
 * @param amount
 *            The numeric value in the underlying derived unit.
 * @return The equivalent value in this unit.
 * @throws ConversionException
 *             Can't convert value.
 */
public double fromDerivedUnit(final double amount)
    throws ConversionException {
  if (!(_unit instanceof DerivableUnit)) {
    throw new ConversionException(getDerivedUnit(), this);
  }
  return ((DerivableUnit) getUnit()).fromDerivedUnit(amount) / getScale();
}
origin: org.lasersonlab.thredds/udunits

/**
 * Converts a numeric value from the underlying derived unit to this unit.
 * 
 * @param amount
 *            The numeric value in the underlying derived unit.
 * @return The equivalent value in this unit.
 * @throws ConversionException
 *             Can't convert value.
 */
public double fromDerivedUnit(final double amount)
    throws ConversionException {
  if (!(_unit instanceof DerivableUnit)) {
    throw new ConversionException(getDerivedUnit(), this);
  }
  return ((DerivableUnit) getUnit()).fromDerivedUnit(amount) / getScale();
}
ucar.unitsScaledUnitgetUnit

Javadoc

Returns the reference unit.

Popular methods of ScaledUnit

  • getScale
    Returns the multiplicative factor.
  • <init>
    Constructs from a multiplicative factor, a reference unit, and an identifier.
  • equals
    Indicates if this unit is semantically identical to an object.
  • fromDerivedUnit
    Converts numeric values from the underlying derived unit to this unit.
  • getCanonicalString
    Returns the canonical string representation of the unit.
  • getDerivedUnit
    Gets the derived unit underlying this unit.
  • getInstance
  • isDimensionless
    Indicates if this unit is dimensionless. A ScaledUnit is dimensionless if and only if the reference
  • multiplyBy
  • raiseTo
  • toDerivedUnit
    Converts numeric values from this unit to the underlying derived unit.
  • divideBy
  • toDerivedUnit,
  • divideBy

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now