Package net.andreinc.mockneat.unit.types
Class Ints
- java.lang.Object
-
- net.andreinc.mockneat.abstraction.MockUnitBase
-
- net.andreinc.mockneat.unit.types.Ints
-
- All Implemented Interfaces:
MockUnit<java.lang.Integer>,MockUnitInt
public class Ints extends MockUnitBase implements MockUnitInt
-
-
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 MockUnitIntbound(java.lang.Integer bound)This method can be used to generate arbitrary integer value in the [0, bound) range.MockUnitIntfrom(int[] alphabet)This method can be used to generate arbitrary integer values from the givenalphabet.static Intsints()Returns aIntsobject that can be used to generate arbitraryIntegernumbers.MockUnitIntlowerBound(int lowerBound)This method can be used to generate arbitrary integer value in [lowerBound, Integer.MAX_VALUE]MockUnitIntrange(java.lang.Integer lowerBound, java.lang.Integer upperBound)This method can be used to generate arbitrary integer values in the [lowerBound, upperBound) range.MockUnitIntrangeClosed(int lowerBound, int upperBound)This method can be used to generate arbitrary integer values in the [lowerBound, upperBound] range.java.util.function.Supplier<java.lang.Integer>supplier()This is the sole abstract method of the interface.MockUnitIntupperBound(int upperBound)This method can be used to generate arbitrary integer value in the [0, bound) range.-
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.MockUnitInt
array, arrayPrimitive, intStream
-
-
-
-
Constructor Detail
-
Ints
protected Ints()
-
Ints
public Ints(MockNeat mockNeat)
-
-
Method Detail
-
ints
public static Ints ints()
Returns a
Intsobject that can be used to generate arbitraryIntegernumbers.Internally the method uses the
Random::nextIntimplementation.- Returns:
- A re-usable
Intsobject. TheIntsclass implementsMockUnitInt.
-
supplier
public java.util.function.Supplier<java.lang.Integer> supplier()
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
bound
public MockUnitInt bound(java.lang.Integer bound)
This method can be used to generate arbitrary integer value in the [0, bound) range.
- Parameters:
bound- The interval bound.- Returns:
- A new
MockUnitInt.
-
upperBound
public MockUnitInt upperBound(int upperBound)
This method can be used to generate arbitrary integer value in the [0, bound) range.
- Parameters:
upperBound- The interval bound. Should be bigger than Zero.- Returns:
- A new
MockUnitInt.
-
lowerBound
public MockUnitInt lowerBound(int lowerBound)
This method can be used to generate arbitrary integer value in [lowerBound, Integer.MAX_VALUE]
- Parameters:
lowerBound- The lower bound. Should be different than Integer.MAX_VALUE and bigger than 0.- Returns:
- A new
MockUnitInt
-
range
public MockUnitInt range(java.lang.Integer lowerBound, java.lang.Integer upperBound)
This method can be used to generate arbitrary integer values in the [lowerBound, upperBound) range.
- Parameters:
lowerBound- The lower bound.upperBound- The upper bound.- Returns:
- A new
MockUnitInt.
-
rangeClosed
public MockUnitInt rangeClosed(int lowerBound, int upperBound)
This method can be used to generate arbitrary integer values in the [lowerBound, upperBound] range.
- Parameters:
lowerBound- The lower bound.upperBound- The upper bound.- Returns:
- A new
MockUnitInt
-
from
public MockUnitInt from(int[] alphabet)
This method can be used to generate arbitrary integer values from the given
alphabet.- Parameters:
alphabet- The alphabet from which the values are selected.- Returns:
- A new
MockUnitInt.
-
-