Class DecimalScaleFactor

java.lang.Object
org.openjdk.jmc.common.unit.ScaleFactor
org.openjdk.jmc.common.unit.DecimalScaleFactor
All Implemented Interfaces:
Comparable<ScaleFactor>, IScalarAffineTransform

public class DecimalScaleFactor extends ScaleFactor
  • Constructor Details

    • DecimalScaleFactor

      public DecimalScaleFactor(int powerOf10)
  • Method Details

    • appendExponentTo

      public static void appendExponentTo(int exp, StringBuilder out)
    • get

      public static DecimalScaleFactor get(int powerOf10)
    • getSciFloorFactor

      public static DecimalScaleFactor getSciFloorFactor(double value)
    • getEngFloorFactor

      public static DecimalScaleFactor getEngFloorFactor(double value)
    • getMultiplier

      public double getMultiplier()
      Returns:
      the multiplier which source values should be multiplied with (before the offset is added)
    • asExponentialStringBuilder

      public StringBuilder asExponentialStringBuilder(boolean multiplicationSign)
    • targetOutOfRange

      public boolean targetOutOfRange(long srcNumericalValue, long maxAbsValue)
    • targetOutOfRange

      public boolean targetOutOfRange(double srcNumericalValue, long maxAbsValue)
    • targetValue

      public long targetValue(long srcNumericalValue)
      Parameters:
      srcNumericalValue - a numerical quantity value, expressed in the source unit
      Returns:
      the corresponding numerical quantity value, when expressed in the target unit, rounded to the closest integer that can be represented by a long
    • targetFloor

      public long targetFloor(long srcNumericalValue)
      Parameters:
      srcNumericalValue - a numerical quantity value, expressed in the source unit
      Returns:
      the floor of the corresponding numerical quantity value, when expressed in the target unit, clamped to a long
    • targetValue

      public double targetValue(double srcNumericalValue)
      Parameters:
      srcNumericalValue - a numerical quantity value, expressed in the source unit
      Returns:
      the corresponding numerical quantity value, when expressed in the target unit
    • isUnity

      public boolean isUnity()
      Returns:
      true iff this represents the identity transform
    • isInteger

      public boolean isInteger()
      Returns:
      true iff this transform can exactly be described by an integer multiplier followed by an integer offset
    • concat

      public ScaleFactor concat(ScaleFactor innerFactor)
      Description copied from class: ScaleFactor
      Concatenate (that is, multiply) this scale factor with innerFactor. This is just a special case of ScaleFactor.concat(IScalarAffineTransform).
      Specified by:
      concat in class ScaleFactor
      Returns:
      the combined scale factor
      See Also:
    • invert

      public DecimalScaleFactor invert()
      Specified by:
      invert in interface IScalarAffineTransform
      Specified by:
      invert in class ScaleFactor
      Returns:
      the inverse transform
    • compareTo

      public int compareTo(ScaleFactor other)
      Specified by:
      compareTo in interface Comparable<ScaleFactor>
      Overrides:
      compareTo in class ScaleFactor
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in class ScaleFactor
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class ScaleFactor