Tabnine Logo
UnconvertibleException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
javax.measure.UnconvertibleException
constructor

Best Java code snippets using javax.measure.UnconvertibleException.<init> (Showing top 8 results out of 315)

origin: geotools/geotools

/**
 * Workaround for RFE #4093999 ("Relax constraint on placement of this()/super() call in
 * constructors").
 *
 * @throws IncommensurableException
 */
private static UnitConverter getConverter(final Unit<Time> source)
    throws IncommensurableException {
  if (source == null) {
    throw new UnconvertibleException(Errors.format(ErrorKeys.NO_UNIT));
  }
  return source.getConverterTo(MILLISECOND);
}
origin: tec.units/unit-ri

public final UnitConverter getConverterTo(Unit<Q> that) throws UnconvertibleException {
 if ((this == that) || this.equals(that))
  return AbstractConverter.IDENTITY; // Shortcut.
 Unit<Q> thisSystemUnit = this.getSystemUnit();
 Unit<Q> thatSystemUnit = that.getSystemUnit();
 if (!thisSystemUnit.equals(thatSystemUnit))
  try {
   return getConverterToAny(that);
  } catch (IncommensurableException e) {
   throw new UnconvertibleException(e);
  }
 UnitConverter thisToSI = this.getSystemConverter();
 UnitConverter thatToSI = that.getConverterTo(thatSystemUnit);
 return thatToSI.inverse().concatenate(thisToSI);
}
origin: tec.uom/uom-se

@Override
public final UnitConverter getConverterTo(Unit<Q> that) throws UnconvertibleException {
 if ((this == that) || this.equals(that))
  return AbstractConverter.IDENTITY; // Shortcut.
 Unit<Q> thisSystemUnit = this.getSystemUnit();
 Unit<Q> thatSystemUnit = that.getSystemUnit();
 if (!thisSystemUnit.equals(thatSystemUnit))
  try {
   return getConverterToAny(that);
  } catch (IncommensurableException e) {
   throw new UnconvertibleException(e);
  }
 UnitConverter thisToSI = this.getSystemConverter();
 UnitConverter thatToSI = that.getConverterTo(thatSystemUnit);
 return thatToSI.inverse().concatenate(thisToSI);
}
origin: tec.units/indriya

private final UnitConverter internalGetConverterTo(Unit<Q> that, boolean useEquals) throws UnconvertibleException {
 if (useEquals) {
  if ((this == that) || this.equals(that))
   return AbstractConverter.IDENTITY;
 } else {
  if (this == that)
   return AbstractConverter.IDENTITY;
 }
 Unit<Q> thisSystemUnit = this.getSystemUnit();
 Unit<Q> thatSystemUnit = that.getSystemUnit();
 if (!thisSystemUnit.equals(thatSystemUnit))
  try {
   return getConverterToAny(that);
  } catch (IncommensurableException e) {
   throw new UnconvertibleException(e);
  }
 UnitConverter thisToSI = this.getSystemConverter();
 UnitConverter thatToSI = that.getConverterTo(thatSystemUnit);
 return thatToSI.inverse().concatenate(thisToSI);
}
origin: apache/sis

/**
 * Returns a converter of numeric values from this unit to another unit of same type.
 *
 * @param  unit  the unit of same type to which to convert the numeric values.
 * @return the converter from this unit to {@code that} unit.
 * @throws UnconvertibleException if the converter can not be constructed.
 */
@Override
public UnitConverter getConverterTo(final Unit<Q> unit) throws UnconvertibleException {
  ArgumentChecks.ensureNonNull("unit", unit);
  final Unit<Q> step = unit.getSystemUnit();
  if (step != this && !equalsIgnoreMetadata(step)) {
    // Should never occur unless parameterized type has been compromised.
    throw new UnconvertibleException(incompatible(unit));
  }
  if (step == unit) {
    return LinearConverter.IDENTITY;
  }
  /*
   * At this point we know that the given units is not a system unit. Ask the conversion
   * FROM the given units (before to inverse it) instead than TO the given units because
   * in Apache SIS implementation, the former returns directly ConventionalUnit.toTarget
   * while the later implies a recursive call to this method.
   */
  return unit.getConverterTo(step).inverse();
}
origin: org.apache.sis.core/sis-utility

/**
 * Returns a converter of numeric values from this unit to another unit of same type.
 *
 * @param  that  the unit of same type to which to convert the numeric values.
 * @return the converter from this unit to {@code that} unit.
 * @throws UnconvertibleException if the converter can not be constructed.
 */
@Override
public UnitConverter getConverterTo(final Unit<Q> that) throws UnconvertibleException {
  ArgumentChecks.ensureNonNull("that", that);
  final Unit<Q> step = that.getSystemUnit();
  if (step != this && !equalsIgnoreMetadata(step)) {
    // Should never occur unless parameterized type has been compromised.
    throw new UnconvertibleException(incompatible(that));
  }
  if (step == that) {
    return LinearConverter.IDENTITY;
  }
  /*
   * At this point we know that the given units is not a system unit. Ask the conversion
   * FROM the given units (before to inverse it) instead than TO the given units because
   * in Apache SIS implementation, the former returns directly ConventionalUnit.toTarget
   * while the later implies a recursive call to this method.
   */
  return that.getConverterTo(step).inverse();
}
origin: org.apache.sis.core/sis-utility

/**
 * Returns a converter of numeric values from this unit to another unit of same type.
 *
 * @param  that  the unit of same type to which to convert the numeric values.
 * @return the converter from this unit to {@code that} unit.
 * @throws UnconvertibleException if the converter can not be constructed.
 */
@Override
public UnitConverter getConverterTo(final Unit<Q> that) throws UnconvertibleException {
  if (that == this) {
    return LinearConverter.IDENTITY;
  }
  ArgumentChecks.ensureNonNull("that", that);
  UnitConverter c = toTarget;
  if (target != that) {                           // Optimization for a common case.
    final Unit<Q> step = that.getSystemUnit();
    if (target != step && !target.isCompatible(step)) {
      // Should never occur unless parameterized type has been compromised.
      throw new UnconvertibleException(incompatible(that));
    }
    c = target.getConverterTo(step).concatenate(c);         // Usually leave 'c' unchanged.
    c =   step.getConverterTo(that).concatenate(c);
  }
  return c;
}
origin: apache/sis

/**
 * Returns a converter of numeric values from this unit to another unit of same type.
 *
 * @param  that  the unit of same type to which to convert the numeric values.
 * @return the converter from this unit to {@code that} unit.
 * @throws UnconvertibleException if the converter can not be constructed.
 */
@Override
public UnitConverter getConverterTo(final Unit<Q> that) throws UnconvertibleException {
  if (that == this) {
    return LinearConverter.IDENTITY;
  }
  ArgumentChecks.ensureNonNull("that", that);
  UnitConverter c = toTarget;
  if (target != that) {                           // Optimization for a common case.
    final Unit<Q> step = that.getSystemUnit();
    if (target != step && !target.isCompatible(step)) {
      // Should never occur unless parameterized type has been compromised.
      throw new UnconvertibleException(incompatible(that));
    }
    c = target.getConverterTo(step).concatenate(c);         // Usually leave 'c' unchanged.
    c =   step.getConverterTo(that).concatenate(c);
  }
  return c;
}
javax.measureUnconvertibleException<init>

Popular methods of UnconvertibleException

  • printStackTrace
  • getMessage

Popular in Java

  • Reading from database using SQL prepared statement
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • compareTo (BigDecimal)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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