@FunctionalInterface public interface Generator
enum types, String and BigInteger.
Most methods provide a default implementation that (directly or indirectly) uses anyBits(int).
The latter is the only method without a default implementation.
package| Modifier and Type | Method and Description |
|---|---|
default BigInteger |
anyBigInteger(BigInteger bound)
|
default BigInteger |
anyBigInteger(BigInteger min,
BigInteger bound)
|
BigInteger |
anyBits(int numBits)
Returns any non-negative
BigInteger representing a sequence of significant bits of a given length. |
default boolean |
anyBoolean()
Returns any
boolean value. |
default byte |
anyByte()
Returns any
byte value. |
default char |
anyChar(String characters)
Returns any
char value of the given characters. |
default double |
anyDouble()
Returns a
double value between zero (incl.) and one (excl.). |
default float |
anyFloat()
Returns a
float value between zero (incl.) and one (excl.). |
default int |
anyInt()
Returns any
int value. |
default int |
anyInt(int bound)
Returns an
int value between zero (incl.) and bound (excl.). |
default int |
anyInt(int min,
int bound)
Returns an
int value between min (incl.) and bound (excl.). |
default long |
anyLong()
Returns any
long value. |
default long |
anyLong(long bound)
Returns any
long value between zero (incl.) and bound (excl.). |
default long |
anyLong(long min,
long bound)
Returns any
long value between min (incl.) and bound (excl.). |
default <T extends Enum<T>> |
anyOf(Class<T> enumClass)
Returns one of the given
enum values. |
default <T> T |
anyOf(T... values)
Returns one of the given
values. |
default short |
anyShort()
Returns any
short value. |
default String |
anyString(int length,
String characters)
|
static Generator |
simple()
|
static Generator |
simple(Random random)
|
static Generator simple()
BigInteger anyBits(int numBits)
BigInteger representing a sequence of significant bits of a given length.
In other words, the result is any value between zero (inclusive) and 2length (exclusive).
A typical implementation will return an arbitrary value within the defined bounds, with each possible value being equally probable.
default boolean anyBoolean()
boolean value.
The default implementation depends on the implementation of anyBits(int).
default byte anyByte()
byte value.
The default implementation depends on the implementation of anyBits(int).
default short anyShort()
short value.
The default implementation depends on the implementation of anyBits(int).
default int anyInt()
int value.
The default implementation depends on the implementation of anyBits(int).
default int anyInt(int bound)
int value between zero (incl.) and bound (excl.).
The default implementation depends on the implementation of anyBigInteger(BigInteger).
default int anyInt(int min,
int bound)
int value between min (incl.) and bound (excl.).
The default implementation depends on the implementation of anyBigInteger(BigInteger, BigInteger).
default long anyLong()
long value.
The default implementation depends on the implementation of anyBits(int).
default long anyLong(long bound)
long value between zero (incl.) and bound (excl.).
The default implementation depends on the implementation of anyBigInteger(BigInteger).
default long anyLong(long min,
long bound)
long value between min (incl.) and bound (excl.).
The default implementation depends on the implementation of anyBigInteger(BigInteger, BigInteger).
default float anyFloat()
float value between zero (incl.) and one (excl.).
The default implementation depends on the implementation of anyBits(int).
default double anyDouble()
double value between zero (incl.) and one (excl.).
The default implementation depends on the implementation of anyBits(int).
default char anyChar(String characters)
char value of the given characters.
The default implementation depends on the implementation of anyInt(int).
characters - A String made up of the characters that are a possible result.default String anyString(int length, String characters)
String with the given length consisting of the given characters.
The default implementation depends on the implementation of anyInt(int).
length - The length of the resulting string.characters - A string made up of the characters that make up a possible result.default BigInteger anyBigInteger(BigInteger bound)
BigInteger value between BigInteger.ZERO (incl.) and bound (excl.).
The default implementation depends on the implementation of anyBits(int).
default BigInteger anyBigInteger(BigInteger min, BigInteger bound)
BigInteger value between min (incl.) and bound (excl.).
The default implementation depends on the implementation of anyBigInteger(BigInteger).
default <T> T anyOf(T... values)
values.
The default implementation depends on the implementation of anyInt(int).
default <T extends Enum<T>> T anyOf(Class<T> enumClass)
enum values.
The default implementation depends on the implementation of anyOf(Object[]).
Copyright © 2023 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.