Class IdentityConverter

java.lang.Object
org.episteme.core.measure.converters.IdentityConverter
All Implemented Interfaces:
UnitConverter

public final class IdentityConverter extends Object implements UnitConverter
The identity converter - performs no conversion.

This is used when converting between the same unit.

* @author Silvere Martin-Michiellot
Since:
1.0
Author:
Gemini AI (Google DeepMind)
  • Field Details

  • Method Details

    • convert

      public Real convert(Real value)
      Description copied from interface: UnitConverter
      Converts a value from the source unit to the target unit.
      Specified by:
      convert in interface UnitConverter
      Parameters:
      value - the value to convert
      Returns:
      the converted value
    • inverse

      public UnitConverter inverse()
      Description copied from interface: UnitConverter
      Returns the inverse of this converter.

      The inverse converter performs the reverse transformation.

      Specified by:
      inverse in interface UnitConverter
      Returns:
      the inverse converter
    • concatenate

      public UnitConverter concatenate(UnitConverter other)
      Description copied from interface: UnitConverter
      Returns a converter that first applies this converter, then the other.

      For example, if this converts meters to feet and other converts feet to miles, the result converts meters to miles.

      Specified by:
      concatenate in interface UnitConverter
      Parameters:
      other - the converter to apply after this one
      Returns:
      the concatenated converter
    • isIdentity

      public boolean isIdentity()
      Description copied from interface: UnitConverter
      Checks if this converter is an identity converter (no conversion).
      Specified by:
      isIdentity in interface UnitConverter
      Returns:
      true if this is the identity converter
    • isLinear

      public boolean isLinear()
      Description copied from interface: UnitConverter
      Checks if this converter is linear (scale only, no offset).

      Linear converters satisfy: f(x + y) = f(x) + f(y) and f(ax) = aâ‹…f(x).

      Specified by:
      isLinear in interface UnitConverter
      Returns:
      true if this converter is linear
    • derivative

      public Real derivative(Real value)
      Description copied from interface: UnitConverter
      Returns the derivative of the conversion function at the given value.

      For linear converters, this is constant. For affine converters (like temperature), this is also constant.

      Specified by:
      derivative in interface UnitConverter
      Parameters:
      value - the value at which to evaluate the derivative
      Returns:
      the derivative (conversion rate)
    • toString

      public String toString()
      Overrides:
      toString in class Object