Tabnine Logo
MultiplyConverter
Code IndexAdd Tabnine to your IDE (free)

How to use
MultiplyConverter
in
javax.measure.converter

Best Java code snippets using javax.measure.converter.MultiplyConverter (Showing top 20 results out of 315)

origin: org.jscience/jscience

private static UnitConverter valueOf(double factor) {
  float asFloat = (float) factor;
  return asFloat == 1.0f ? UnitConverter.IDENTITY
      : new MultiplyConverter(factor);
}
origin: net.java.dev.jsr-275/jsr-275

@Override
public UnitConverter concatenate(UnitConverter converter) {
  if (converter instanceof MultiplyConverter) {
    double factor = _factor * ((MultiplyConverter) converter)._factor;
    return valueOf(factor);
  } else if (converter instanceof RationalConverter) {
    double factor = _factor
        * ((RationalConverter) converter).getDividend()
        / ((RationalConverter) converter).getDivisor();
    return valueOf(factor);
  } else {
    return super.concatenate(converter);
  }
}
origin: org.jscience/jscience

} else if (cvtr instanceof MultiplyConverter) {
  result.append('*');
  result.append(((MultiplyConverter) cvtr).getFactor());
} else { // Other converters.
  return "[" + baseUnits + "?]";
origin: org.jscience/jscience

@Override
public UnitConverter concatenate(UnitConverter converter) {
  if (converter instanceof MultiplyConverter) {
    double factor = _factor * ((MultiplyConverter) converter)._factor;
    return valueOf(factor);
  } else if (converter instanceof RationalConverter) {
    double factor = _factor
        * ((RationalConverter) converter).getDividend()
        / ((RationalConverter) converter).getDivisor();
    return valueOf(factor);
  } else {
    return super.concatenate(converter);
  }
}
origin: net.java.dev.jsr-275/jsr-275

} else if (cvtr instanceof MultiplyConverter) {
  result.append('*');
  result.append(((MultiplyConverter) cvtr).getFactor());
} else { // Other converters.
  return "[" + baseUnits + "?]";
origin: net.java.dev.jsr-275/jsr-275

private static UnitConverter valueOf(double factor) {
  float asFloat = (float) factor;
  return asFloat == 1.0f ? UnitConverter.IDENTITY
      : new MultiplyConverter(factor);
}
origin: mkulesh/microMathematics

@Override
public UnitConverter concatenate(UnitConverter converter) {
  if (converter instanceof MultiplyConverter) {
    double factor = _factor * ((MultiplyConverter) converter)._factor;
    return valueOf(factor);
  } else if (converter instanceof RationalConverter) {
    double factor = _factor
        * ((RationalConverter) converter).getDividend()
        / ((RationalConverter) converter).getDivisor();
    return valueOf(factor);
  } else {
    return super.concatenate(converter);
  }
}
origin: mkulesh/microMathematics

  result.append(((MultiplyConverter) cvtr).getFactor());
} else { // Other converters.
  return "[" + baseUnits + "?]";
origin: mkulesh/microMathematics

private static UnitConverter valueOf(double factor) {
  float asFloat = (float) factor;
  return asFloat == 1.0f ? UnitConverter.IDENTITY
      : new MultiplyConverter(factor);
}
origin: mkulesh/microMathematics

@Override
public UnitConverter inverse() {
  return new MultiplyConverter(1.0 / _factor);
}
origin: org.jscience/jscience

@Override
public UnitConverter inverse() {
  return new MultiplyConverter(1.0 / _factor);
}
origin: net.java.dev.jsr-275/jsr-275

@Override
public UnitConverter inverse() {
  return new MultiplyConverter(1.0 / _factor);
}
origin: net.java.dev.jsr-275/jsr-275

/**
 * Returns the result of multiplying this unit by a an approximate factor
 *
 * @param  factor the approximate factor (e.g. 
 *         <code>ELECTRON_MASS = KILOGRAM.times(9.10938188e-31)</code>).
 * @return <code>this.transform(new MultiplyConverter(factor))</code>
 */
public final Unit<Q> times(double factor) {
  return transform(new MultiplyConverter(factor));
}
origin: mkulesh/microMathematics

/**
 * Returns the result of multiplying this unit by a an approximate factor
 *
 * @param  factor the approximate factor (e.g. 
 *         <code>ELECTRON_MASS = KILOGRAM.times(9.10938188e-31)</code>).
 * @return <code>this.transform(new MultiplyConverter(factor))</code>
 */
public final Unit<Q> times(double factor) {
  return transform(new MultiplyConverter(factor));
}
origin: mkulesh/microMathematics

/**
 * Returns the result of dividing this unit by an approximate divisor.
 *
 * @param  divisor the approximate divisor.
 * @return <code>this.transform(new MultiplyConverter(1.0 / divisor))</code>
 */
public final Unit<Q> divide(double divisor) {
  return transform(new MultiplyConverter(1.0 / divisor));
}
origin: org.jscience/jscience

/**
 * Returns the result of dividing this unit by an approximate divisor.
 *
 * @param  divisor the approximate divisor.
 * @return <code>this.transform(new MultiplyConverter(1.0 / divisor))</code>
 */
public final Unit<Q> divide(double divisor) {
  return transform(new MultiplyConverter(1.0 / divisor));
}
origin: net.java.dev.jsr-275/jsr-275

/**
 * Returns the result of dividing this unit by an approximate divisor.
 *
 * @param  divisor the approximate divisor.
 * @return <code>this.transform(new MultiplyConverter(1.0 / divisor))</code>
 */
public final Unit<Q> divide(double divisor) {
  return transform(new MultiplyConverter(1.0 / divisor));
}
origin: org.jscience/jscience

/**
 * Returns the result of multiplying this unit by a an approximate factor
 *
 * @param  factor the approximate factor (e.g. 
 *         <code>ELECTRON_MASS = KILOGRAM.times(9.10938188e-31)</code>).
 * @return <code>this.transform(new MultiplyConverter(factor))</code>
 */
public final Unit<Q> times(double factor) {
  return transform(new MultiplyConverter(factor));
}
origin: org.jscience/jscience

@Override
public UnitConverter concatenate(UnitConverter converter) {
  if (converter instanceof RationalConverter) {
    RationalConverter that = (RationalConverter) converter;
    long dividendLong = this._dividend * that._dividend;
    long divisorLong = this._divisor * that._divisor;
    double dividendDouble = ((double)this._dividend) * that._dividend;
    double divisorDouble = ((double)this._divisor) * that._divisor;
    if ((dividendLong != dividendDouble) || 
        (divisorLong != divisorDouble)) { // Long overflows.
      return new MultiplyConverter(dividendDouble / divisorDouble);
    }
    long gcd = gcd(dividendLong, divisorLong);
    return RationalConverter.valueOf(dividendLong / gcd, divisorLong / gcd);
  } else if (converter instanceof MultiplyConverter) {
    return converter.concatenate(this);
  } else {
    return super.concatenate(converter);
  }
}
origin: net.java.dev.jsr-275/jsr-275

@Override
public UnitConverter concatenate(UnitConverter converter) {
  if (converter instanceof RationalConverter) {
    RationalConverter that = (RationalConverter) converter;
    long dividendLong = this._dividend * that._dividend;
    long divisorLong = this._divisor * that._divisor;
    double dividendDouble = ((double)this._dividend) * that._dividend;
    double divisorDouble = ((double)this._divisor) * that._divisor;
    if ((dividendLong != dividendDouble) || 
        (divisorLong != divisorDouble)) { // Long overflows.
      return new MultiplyConverter(dividendDouble / divisorDouble);
    }
    long gcd = gcd(dividendLong, divisorLong);
    return RationalConverter.valueOf(dividendLong / gcd, divisorLong / gcd);
  } else if (converter instanceof MultiplyConverter) {
    return converter.concatenate(this);
  } else {
    return super.concatenate(converter);
  }
}
javax.measure.converterMultiplyConverter

Javadoc

This class represents a converter multiplying numeric values by a constant scaling factor (approximated as a double). For exact scaling conversions RationalConverter is preferred.

Instances of this class are immutable.

Most used methods

  • <init>
    Creates a multiply converter with the specified scale factor.
  • getFactor
    Returns the scale factor.
  • valueOf

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for WebStorm
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