Class CoinFunc
- java.lang.Object
-
- io.virtdata.libbasics.shared.from_long.to_object.CoinFunc
-
- All Implemented Interfaces:
java.util.function.Function<java.lang.Long,java.lang.Object>
public class CoinFunc extends java.lang.Object implements java.util.function.Function<java.lang.Long,java.lang.Object>This is a higher-order function which takes an input value, and flips a coin. The first parameter is used as the threshold for choosing a function. If the sample values derived from the input is lower than the threshold value, then the first following function is used, and otherwise the second is used. For example, if the threshold is 0.23, and the input value is hashed and sampled in the unit interval to 0.43, then the second of the two provided functions will be used. The input value does not need to be hashed beforehand, since the user may need to use the full input value before hashing as the input to one or both of the functions. This function will accept either a LongFunction or aFunctionor a LongUnaryOperator in either position. If necessary, useToLongFunctionto adapt other function forms to be compatible with these signatures.
-
-
Constructor Summary
Constructors Constructor Description CoinFunc(double threshold, java.util.function.Function<java.lang.Long,? extends java.lang.Object> first, java.util.function.Function<java.lang.Long,? extends java.lang.Object> second)CoinFunc(double threshold, java.util.function.Function<java.lang.Long,? extends java.lang.Object> first, java.util.function.LongFunction<? extends java.lang.Object> second)CoinFunc(double threshold, java.util.function.Function<java.lang.Long,? extends java.lang.Object> first, java.util.function.LongUnaryOperator second)CoinFunc(double threshold, java.util.function.LongFunction<? extends java.lang.Object> first, java.util.function.Function<java.lang.Long,? extends java.lang.Object> second)CoinFunc(double threshold, java.util.function.LongFunction<? extends java.lang.Object> first, java.util.function.LongFunction<? extends java.lang.Object> second)CoinFunc(double threshold, java.util.function.LongFunction<? extends java.lang.Object> first, java.util.function.LongUnaryOperator second)CoinFunc(double threshold, java.util.function.LongUnaryOperator first, java.util.function.Function<java.lang.Long,? extends java.lang.Object> second)CoinFunc(double threshold, java.util.function.LongUnaryOperator first, java.util.function.LongFunction<? extends java.lang.Object> second)CoinFunc(double threshold, java.util.function.LongUnaryOperator first, java.util.function.LongUnaryOperator second)
-
Method Summary
Modifier and Type Method Description java.lang.Objectapply(java.lang.Long aLong)
-
-
-
Constructor Detail
-
CoinFunc
public CoinFunc(double threshold, java.util.function.LongFunction<? extends java.lang.Object> first, java.util.function.LongFunction<? extends java.lang.Object> second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.LongFunction<? extends java.lang.Object> first, java.util.function.Function<java.lang.Long,? extends java.lang.Object> second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.LongFunction<? extends java.lang.Object> first, java.util.function.LongUnaryOperator second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.Function<java.lang.Long,? extends java.lang.Object> first, java.util.function.Function<java.lang.Long,? extends java.lang.Object> second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.Function<java.lang.Long,? extends java.lang.Object> first, java.util.function.LongFunction<? extends java.lang.Object> second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.Function<java.lang.Long,? extends java.lang.Object> first, java.util.function.LongUnaryOperator second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.LongUnaryOperator first, java.util.function.Function<java.lang.Long,? extends java.lang.Object> second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.LongUnaryOperator first, java.util.function.LongFunction<? extends java.lang.Object> second)
-
CoinFunc
public CoinFunc(double threshold, java.util.function.LongUnaryOperator first, java.util.function.LongUnaryOperator second)
-
-