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
public class BinaryScaleFactor extends ScaleFactor
-
-
Field Summary
Fields Modifier and Type Field Description protected intpowerOf2
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringBuilderasExponentialStringBuilder(boolean multiplicationSign)intcompareTo(ScaleFactor other)ScaleFactorconcat(ScaleFactor innerFactor)Concatenate (that is, multiply) this scale factor withinnerFactor.booleanequals(Object other)static BinaryScaleFactorget(int powerOf2)static BinaryScaleFactorgetFloor1024Factor(double value)static BinaryScaleFactorgetFloor2Factor(long value)doublegetMultiplier()inthashCode()BinaryScaleFactorinvert()booleanisInteger()booleanisUnity()longtargetFloor(long srcNumericalValue)booleantargetOutOfRange(double srcNumericalValue, long maxAbsValue)booleantargetOutOfRange(long srcNumericalValue, long maxAbsValue)doubletargetValue(double srcNumericalValue)longtargetValue(long srcNumericalValue)-
Methods inherited from class org.openjdk.jmc.common.unit.ScaleFactor
concat, getOffset, invertAndConcat, invertAndConcat, targetFloor, targetIntFloor, targetNumber, targetNumber
-
-
-
-
Method Detail
-
get
public static BinaryScaleFactor get(int powerOf2)
-
getFloor2Factor
public static BinaryScaleFactor getFloor2Factor(long value)
-
getFloor1024Factor
public static BinaryScaleFactor getFloor1024Factor(double value)
-
getMultiplier
public double getMultiplier()
- Returns:
- the multiplier which source values should be multiplied with (before the
offsetis 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: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:
ScaleFactor.concat(IScalarAffineTransform)
-
invert
public BinaryScaleFactor invert()
- Specified by:
invertin interfaceIScalarAffineTransform- Specified by:
invertin classScaleFactor- Returns:
- the inverse transform
-
compareTo
public int compareTo(ScaleFactor other)
- Specified by:
compareToin interfaceComparable<ScaleFactor>- Overrides:
compareToin classScaleFactor
-
equals
public boolean equals(Object other)
- Specified by:
equalsin classScaleFactor
-
hashCode
public int hashCode()
- Specified by:
hashCodein classScaleFactor
-
-