Package org.openjdk.jmc.common.unit
Class LongScaleFactor
java.lang.Object
org.openjdk.jmc.common.unit.ScaleFactor
org.openjdk.jmc.common.unit.LongScaleFactor
- All Implemented Interfaces:
Comparable<ScaleFactor>,IScalarAffineTransform
Short term
ScaleFactor implementation to improve custom units.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconcat(ScaleFactor innerFactor) Concatenate (that is, multiply) this scale factor withinnerFactor.booleandoubleinthashCode()invert()invertAndConcat(ScaleFactor innerFactor) Concatenate (that is, multiply) the inverse of this scale factor withinnerFactor.booleanbooleanisUnity()longtargetFloor(long srcNumericalValue) targetNumber(long srcNumericalValue) booleantargetOutOfRange(double srcNumericalValue, long maxAbsValue) booleantargetOutOfRange(long srcNumericalValue, long maxAbsValue) doubletargetValue(double srcNumericalValue) longtargetValue(long srcNumericalValue) toString()Methods inherited from class org.openjdk.jmc.common.unit.ScaleFactor
compareTo, concat, getOffset, invertAndConcat, scale, targetFloor, targetIntFloor, targetNumber
-
Constructor Details
-
LongScaleFactor
public LongScaleFactor(long factor)
-
-
Method Details
-
concat
Description copied from class:ScaleFactorConcatenate (that is, multiply) this scale factor withinnerFactor. This is just a special case ofScaleFactor.concat(IScalarAffineTransform).- Specified by:
concatin classScaleFactor- Returns:
- the combined scale factor
- See Also:
-
invertAndConcat
Description copied from class:ScaleFactorConcatenate (that is, multiply) the inverse of this scale factor withinnerFactor. This is just a special case ofScaleFactor.invertAndConcat(IScalarAffineTransform).- Overrides:
invertAndConcatin classScaleFactor- Returns:
- the combined scale factor
- See Also:
-
invert
- Specified by:
invertin interfaceIScalarAffineTransform- Specified by:
invertin classScaleFactor- 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
- Specified by:
targetNumberin interfaceIScalarAffineTransform- Overrides:
targetNumberin classScaleFactor- 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
Longif it can exactly be represented in one, otherwise as some otherNumberwith at least the precision ofdouble
-
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
- Specified by:
equalsin classScaleFactor
-
hashCode
public int hashCode()- Specified by:
hashCodein classScaleFactor
-
toString
-
getMultiplier
public double getMultiplier()- Returns:
- the multiplier which source values should be multiplied with (before the
offsetis added)
-