Class NumericFunctions
Object
NumericFunctions
Helper methods for using numeric functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DoubledoubleOrNull(Number number) static <T> DoubledoubleOrNull(T argument, Function<? super T, ? extends Number> function) static doubledoubleOrZero(Number number) static <T> doubledoubleOrZero(T argument, Function<? super T, ? extends Number> function) static booleanstatic longlongAddOrNull(long a, Long b) static LonglongAddOrNull(Number a, Number b) Appends two numbers as long's with tracking of nulls Axioms: null + a == a, a + null == a, a + b == a + b, null + null == nullstatic LonglongOrNull(Number number) static <T> LonglongOrNull(T argument, Function<? super T, ? extends Number> function) static longlongOrZero(Number number) static <T> longlongOrZero(T argument, Function<? super T, ? extends Number> function) static doublenonNegativeDouble(Number number) static <T> doublenonNegativeDouble(T argument, Function<? super T, ? extends Number> function) static DoubleAppends two numbers as double's with tracking of nulls and clipping to zero.static longnonNegativeLong(Number number) static <T> longnonNegativeLong(T argument, Function<? super T, ? extends Number> function)
-
Constructor Details
-
NumericFunctions
public NumericFunctions()
-
-
Method Details
-
longOrZero
- Parameters:
number- a number- Returns:
- The given number's
longvalue, 0L ifnull
-
longOrZero
- Parameters:
argument- an argumentfunction- a numeric function- Returns:
- The given function's
longvalue for the argument, 0L if anything isnull
-
longOrNull
- Parameters:
number- a number- Returns:
- A
Longwith the given number'slongvalue,nullifnumberisnull
-
longOrNull
@Nullable public static <T> Long longOrNull(T argument, Function<? super T, ? extends Number> function) - Parameters:
argument- an argumentfunction- a numeric function- Returns:
- A
Longwith the given function'slongvalue for the argument,nullif anything isnull
-
nonNegativeLong
- Parameters:
number- a number- Returns:
- The given number's
longvalue, 0L ifnullor negative
-
nonNegativeLong
- Parameters:
argument- an argumentfunction- a numeric function- Returns:
- The given function's
longvalue for the argument, 0L if anything isnullor negative
-
doubleOrZero
- Parameters:
number- a number- Returns:
- The given number's
doublevalue, 0.0 ifnull
-
doubleOrZero
- Parameters:
argument- an argumentfunction- a numeric function- Returns:
- The given function's
doublevalue for the argument, 0.0 if anything isnull
-
doubleOrNull
- Parameters:
number- a number- Returns:
- A
Doublewith the given number'sdoublevalue,nullifnumberisnull
-
doubleOrNull
@Nullable public static <T> Double doubleOrNull(T argument, Function<? super T, ? extends Number> function) - Parameters:
argument- an argumentfunction- a numeric function- Returns:
- A
Doublewith the given function'sdoublevalue for the argument,nullif anything isnull
-
nonNegativeDouble
- Parameters:
number- a number- Returns:
- The given number's
doublevalue, 0.0 ifnullor negative
-
nonNegativeDouble
public static <T> double nonNegativeDouble(T argument, Function<? super T, ? extends Number> function) - Parameters:
argument- an argumentfunction- a numeric function- Returns:
- The given function's
doublevalue for the argument, 0.0 if anything isnullor negative
-
nonNegativeDoubleAddOrNull
Appends two numbers as double's with tracking of nulls and clipping to zero. Axioms: null + a == a, a + null == a, a + b == a + b, null + null == null- Parameters:
a- first operandb- second operand- Returns:
- a + b or null
-
longAddOrNull
Appends two numbers as long's with tracking of nulls Axioms: null + a == a, a + null == a, a + b == a + b, null + null == null- Parameters:
a- first operandb- second operand- Returns:
- a + b or null
-
longAddOrNull
-
equals
-