Codota Logo
ScaledUnit.<init>
Code IndexAdd Codota to your IDE (free)

How to use
ucar.units.ScaledUnit
constructor

Best Java code snippets using ucar.units.ScaledUnit.<init> (Showing top 18 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

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: 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: 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

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

/**
 * 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

/**
 * 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

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

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

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

/**
 * 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;
}
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: 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

/**
 * 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

/**
 * 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

/**
 * 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

final BaseUnit meter = BaseUnit.getOrCreate(UnitName.newUnitName(
    "meter", null, "m"), BaseQuantity.LENGTH);
final ScaledUnit nauticalMile = new ScaledUnit(1852f, meter);
System.out.println("nauticalMile.getUnit().equals(meter)="
    + nauticalMile.getUnit().equals(meter));
System.out.println("nauticalMile.equals(nauticalMile)="
    + nauticalMile.equals(nauticalMile));
final ScaledUnit nautical2Mile = new ScaledUnit(2, nauticalMile);
System.out.println("nauticalMile.equals(nautical2Mile)="
    + nauticalMile.equals(nautical2Mile));
final BaseUnit radian = BaseUnit.getOrCreate(UnitName.newUnitName(
    "radian", null, "rad"), BaseQuantity.PLANE_ANGLE);
final ScaledUnit degree = new ScaledUnit(3.14159 / 180, radian);
System.out.println("degree.isDimensionless()="
    + degree.isDimensionless());
origin: org.lasersonlab.thredds/udunits

final BaseUnit meter = BaseUnit.getOrCreate(UnitName.newUnitName(
    "meter", null, "m"), BaseQuantity.LENGTH);
final ScaledUnit nauticalMile = new ScaledUnit(1852f, meter);
System.out.println("nauticalMile.getUnit().equals(meter)="
    + nauticalMile.getUnit().equals(meter));
System.out.println("nauticalMile.equals(nauticalMile)="
    + nauticalMile.equals(nauticalMile));
final ScaledUnit nautical2Mile = new ScaledUnit(2, nauticalMile);
System.out.println("nauticalMile.equals(nautical2Mile)="
    + nauticalMile.equals(nautical2Mile));
final BaseUnit radian = BaseUnit.getOrCreate(UnitName.newUnitName(
    "radian", null, "rad"), BaseQuantity.PLANE_ANGLE);
final ScaledUnit degree = new ScaledUnit(3.14159 / 180, radian);
System.out.println("degree.isDimensionless()="
    + degree.isDimensionless());
ucar.unitsScaledUnit<init>

Javadoc

Constructs from a multiplicative factor. Returns a dimensionless unit whose value is the multiplicative factor rather than unity.

Popular methods of ScaledUnit

  • getScale
    Returns the multiplicative factor.
  • getUnit
    Returns the reference unit.
  • 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

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • getExternalFilesDir (Context)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • JButton (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
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