Package net.andreinc.mockneat.unit.types
Class Doubles
- java.lang.Object
-
- net.andreinc.mockneat.abstraction.MockUnitBase
-
- net.andreinc.mockneat.unit.types.Doubles
-
- All Implemented Interfaces:
MockUnit<java.lang.Double>,MockUnitDouble
public class Doubles extends MockUnitBase implements MockUnitDouble
-
-
Field Summary
-
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MockUnitDoublebound(double bound)Returns a newMockUnitDoublethat can be used to generate double values bounded by a specific value [0,bound).static Doublesdoubles()Returns aDoublesobject that can be used to generate arbitrarydoublevalues.MockUnitDoublefrom(double[] alphabet)Returns a newMockUnitDoublethat can be used to generate values from a specific alphabet (array).MockUnitDoublegaussians()Returns a newMockUnitDoublethat can be used to generate double values (gaussian distribution).MockUnitDoublerange(double lowerBound, double upperBound)Returns a newMockUnitDoublethat can be used to generate double values into a given range [lowerBound,upperBound).java.util.function.Supplier<java.lang.Double>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
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnitDouble
array, arrayPrimitive, doubleStream
-
-
-
-
Constructor Detail
-
Doubles
protected Doubles()
-
Doubles
public Doubles(MockNeat mockNeat)
-
-
Method Detail
-
doubles
public static Doubles doubles()
Returns a
Doublesobject that can be used to generate arbitrarydoublevalues.Note: By default the
Doublesobject returns a random double in the [0.0, 1.0) interval.- Returns:
- A re-usable
Doublesobject. TheDoublesclass implementsMockUnitDouble.
-
supplier
public java.util.function.Supplier<java.lang.Double> supplier()
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
gaussians
public MockUnitDouble gaussians()
Returns a new
MockUnitDoublethat can be used to generate double values (gaussian distribution).- Returns:
- A new
MockUnitDouble
-
range
public MockUnitDouble range(double lowerBound, double upperBound)
Returns a new
MockUnitDoublethat can be used to generate double values into a given range [lowerBound,upperBound).- Parameters:
lowerBound- The lower range.upperBound- The upper range.- Returns:
- A new
MockUnitDouble
-
bound
public MockUnitDouble bound(double bound)
Returns a newMockUnitDoublethat can be used to generate double values bounded by a specific value [0,bound).- Parameters:
bound- The bound value.- Returns:
- A new
MockUnitDouble
-
from
public MockUnitDouble from(double[] alphabet)
Returns a newMockUnitDoublethat can be used to generate values from a specific alphabet (array).- Parameters:
alphabet- The source of elements.- Returns:
- A new
MockUnitDouble
-
-