Package org.openjdk.jmc.common.unit
Class BinaryScaleFactor
java.lang.Object
org.openjdk.jmc.common.unit.ScaleFactor
org.openjdk.jmc.common.unit.BinaryScaleFactor
- All Implemented Interfaces:
Comparable<ScaleFactor>
,IScalarAffineTransform
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionasExponentialStringBuilder
(boolean multiplicationSign) int
compareTo
(ScaleFactor other) concat
(ScaleFactor innerFactor) Concatenate (that is, multiply) this scale factor withinnerFactor
.boolean
static BinaryScaleFactor
get
(int powerOf2) static BinaryScaleFactor
getFloor1024Factor
(double value) static BinaryScaleFactor
getFloor2Factor
(long value) double
int
hashCode()
invert()
boolean
boolean
isUnity()
long
targetFloor
(long srcNumericalValue) boolean
targetOutOfRange
(double srcNumericalValue, long maxAbsValue) boolean
targetOutOfRange
(long srcNumericalValue, long maxAbsValue) double
targetValue
(double srcNumericalValue) long
targetValue
(long srcNumericalValue) Methods inherited from class org.openjdk.jmc.common.unit.ScaleFactor
concat, getOffset, invertAndConcat, invertAndConcat, scale, targetFloor, targetIntFloor, targetNumber, targetNumber
-
Field Details
-
powerOf2
protected final int powerOf2
-
-
Method Details
-
get
-
getFloor2Factor
-
getFloor1024Factor
-
getMultiplier
public double getMultiplier()- Returns:
- the multiplier which source values should be multiplied with (before the
offset
is added)
-
asExponentialStringBuilder
-
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
Description copied from class:ScaleFactor
Concatenate (that is, multiply) this scale factor withinnerFactor
. This is just a special case ofScaleFactor.concat(IScalarAffineTransform)
.- Specified by:
concat
in classScaleFactor
- Returns:
- the combined scale factor
- See Also:
-
invert
- Specified by:
invert
in interfaceIScalarAffineTransform
- Specified by:
invert
in classScaleFactor
- Returns:
- the inverse transform
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ScaleFactor>
- Overrides:
compareTo
in classScaleFactor
-
equals
- Specified by:
equals
in classScaleFactor
-
hashCode
public int hashCode()- Specified by:
hashCode
in classScaleFactor
-