public class LongPreOffsetTransform extends Object implements IScalarAffineTransform
Transform
that adds an offset first and then multiplies with the
multiplier. This is typically used to reduce cancellation errors when the offset is larger than
can be accurately represented in a double.Constructor and Description |
---|
LongPreOffsetTransform(long preOffset,
double multiplier) |
Modifier and Type | Method and Description |
---|---|
IScalarAffineTransform |
concat(IScalarAffineTransform innerTransform)
Concatenate this transform with
innerTransform , such that applying the resulting
transform is equivalent to first applying innerTransform and then applying this
transform on the resulting value. |
boolean |
equals(Object other) |
double |
getMultiplier() |
Number |
getOffset() |
int |
hashCode() |
IScalarAffineTransform |
invert() |
IScalarAffineTransform |
invertAndConcat(IScalarAffineTransform innerTransform)
Concatenate the inverse of this transform with
innerTransform , such that applying the
resulting transform is equivalent to first applying innerTransform and then applying
this inverse of this transform on the resulting value. |
boolean |
isInteger() |
boolean |
isUnity() |
double |
targetFloor(double srcNumericalValue) |
long |
targetFloor(long srcNumericalValue) |
int |
targetIntFloor(Number srcNumericalValue) |
Number |
targetNumber(long srcNumericalValue) |
Number |
targetNumber(Number srcNumericalValue) |
boolean |
targetOutOfRange(double srcNumericalValue,
long maxAbsValue) |
boolean |
targetOutOfRange(long srcNumericalValue,
long maxAbsValue) |
double |
targetValue(double srcNumericalValue) |
long |
targetValue(long srcNumericalValue) |
public LongPreOffsetTransform(long preOffset, double multiplier)
public Number getOffset()
getOffset
in interface IScalarAffineTransform
multiplier
)public double getMultiplier()
getMultiplier
in interface IScalarAffineTransform
offset
is added)public boolean targetOutOfRange(long srcNumericalValue, long maxAbsValue)
targetOutOfRange
in interface IScalarAffineTransform
public boolean targetOutOfRange(double srcNumericalValue, long maxAbsValue)
targetOutOfRange
in interface IScalarAffineTransform
public long targetValue(long srcNumericalValue)
targetValue
in interface IScalarAffineTransform
srcNumericalValue
- a numerical quantity value, expressed in the source unitlong
public long targetFloor(long srcNumericalValue)
targetFloor
in interface IScalarAffineTransform
srcNumericalValue
- a numerical quantity value, expressed in the source unitlong
public double targetFloor(double srcNumericalValue)
targetFloor
in interface IScalarAffineTransform
srcNumericalValue
- a numerical quantity value, expressed in the source unitpublic int targetIntFloor(Number srcNumericalValue)
targetIntFloor
in interface IScalarAffineTransform
srcNumericalValue
- a numerical quantity value, expressed in the source unitint
public Number targetNumber(long srcNumericalValue)
targetNumber
in interface IScalarAffineTransform
srcNumericalValue
- an exact numerical quantity value, expressed in the source unitLong
if it can exactly be represented in one, otherwise as some other
Number
with at least the precision of double
public Number targetNumber(Number srcNumericalValue)
targetNumber
in interface IScalarAffineTransform
srcNumericalValue
- an exact or inexact numerical quantity value, expressed in the source unitLong
if it can exactly be represented in one, otherwise as some other
Number
with at least the precision of double
public double targetValue(double srcNumericalValue)
targetValue
in interface IScalarAffineTransform
srcNumericalValue
- a numerical quantity value, expressed in the source unitpublic IScalarAffineTransform invert()
invert
in interface IScalarAffineTransform
public boolean isUnity()
isUnity
in interface IScalarAffineTransform
public boolean isInteger()
isInteger
in interface IScalarAffineTransform
public IScalarAffineTransform concat(IScalarAffineTransform innerTransform)
IScalarAffineTransform
innerTransform
, such that applying the resulting
transform is equivalent to first applying innerTransform
and then applying this
transform on the resulting value. That is, R(v) = T(I(v)), where R(v) is the resulting
transform, T(v) is this transform, and I(v) is innerTransform
.
In this snippet, v1
and v2
should be equal, apart from numerical precision,
for any v
.
IScalarAffineTransform R, T = ..., I = ...; double v = ...; R = T.concat(I); double v1 = R.targetValue(v); double v2 = T.targetValue(I.targetValue(v));
concat
in interface IScalarAffineTransform
innerTransform
- the transform that should be applied before this transformpublic IScalarAffineTransform invertAndConcat(IScalarAffineTransform innerTransform)
IScalarAffineTransform
innerTransform
, such that applying the
resulting transform is equivalent to first applying innerTransform
and then applying
this inverse of this transform on the resulting value. That is, R(v) = T-1(I(v)),
where R(v) is the resulting transform, T-1(v) is the inverse of this transform,
and I(v) is innerTransform
.
In this snippet, v1
and v2
should be equal, apart from numerical precision,
for any v
.
IScalarAffineTransform R, T = ..., I = ...; double v = ...; R = T.invertAndConcat(I); double v1 = R.targetValue(v); double v2 = T.invert().targetValue(I.targetValue(v));
invertAndConcat
in interface IScalarAffineTransform
innerTransform
- the transform that should be applied before this transformCopyright © 2020. All rights reserved.