Class Probabilities<T>
- java.lang.Object
-
- net.andreinc.mockneat.abstraction.MockUnitBase
-
- net.andreinc.mockneat.unit.objects.Probabilities<T>
-
- All Implemented Interfaces:
MockUnit<T>
public class Probabilities<T> extends MockUnitBase implements MockUnit<T>
-
-
Field Summary
-
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat
-
-
Constructor Summary
Constructors Constructor Description Probabilities(MockNeat mockNeat, java.lang.Class<T> cls)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Probabilities<T>add(java.lang.Double prob, MockUnit<T> mock)Probabilities<T>add(java.lang.Double prob, T obj)static <T> Probabilities<T>probabilities(java.lang.Class<T> cls)Returns aProbabilitiesobject that can be used to generate arbitrary data with a given probability.java.util.function.Supplier<T>supplier()This is the sole abstract method of the interface.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
-
-
-
Method Detail
-
probabilities
public static <T> Probabilities<T> probabilities(java.lang.Class<T> cls)
Returns a
Probabilitiesobject that can be used to generate arbitrary data with a given probability.- Type Parameters:
T- The type of the class for returning probabilities- Parameters:
cls- The type we are going to generate.- Returns:
- A re-usable
Probabilitiesobject. The class implementsMockUnit<T>.
-
supplier
public java.util.function.Supplier<T> supplier()
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
add
public Probabilities<T> add(java.lang.Double prob, MockUnit<T> mock)
-
add
public Probabilities<T> add(java.lang.Double prob, T obj)
-
-