Class LongScaleFactor

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

public class LongScaleFactor extends ScaleFactor
Short term ScaleFactor implementation to improve custom units.
  • Constructor Details

    • LongScaleFactor

      public LongScaleFactor(long factor)
  • Method Details

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

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

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

      public boolean targetOutOfRange(double srcNumericalValue, long maxAbsValue)
    • 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
    • targetOutOfRange

      public boolean targetOutOfRange(long 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
    • targetNumber

      public Number targetNumber(long srcNumericalValue)
      Specified by:
      targetNumber in interface IScalarAffineTransform
      Overrides:
      targetNumber in class ScaleFactor
      Parameters:
      srcNumericalValue - an exact numerical quantity value, expressed in the source unit
      Returns:
      the corresponding numerical quantity value, when expressed in the target unit, as a Long if it can exactly be represented in one, otherwise as some other Number with at least the precision of double
    • 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
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object
    • getMultiplier

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