Interface SeededVariableAmount<T>
- Type Parameters:
T
- The seed object type
- All Known Implementing Classes:
SeededVariableAmount.WrappedVariableAmount
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a value which may vary depending on a seed object.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
ASeededVariableAmount
which wraps anotherVariableAmount
and defers all operations to the inner VariableAmount without the seed. -
Method Summary
Modifier and TypeMethodDescriptiondouble
amount
(RandomGenerator rand, T seed) Gets an instance of the variable amount depending on the given random object and the seed object.static <T> SeededVariableAmount
<T> fixed
(double value) Creates a new 'fixed' variable amount, calls toamount(java.util.random.RandomGenerator, T)
will always return the fixed value.default int
flooredAmount
(RandomGenerator rand, T seed) Gets the amount as if fromamount(RandomGenerator, Object)
but floored to the nearest integer equivalent.static <T> SeededVariableAmount
<T> wrapped
(VariableAmount value) Creates a new variable amount wrapping the givenVariableAmount
, calls toamount(java.util.random.RandomGenerator, T)
will always return wrapped amounts value.
-
Method Details
-
fixed
Creates a new 'fixed' variable amount, calls toamount(java.util.random.RandomGenerator, T)
will always return the fixed value.- Type Parameters:
T
- The seed object type- Parameters:
value
- The fixed value- Returns:
- A variable amount representation
-
wrapped
Creates a new variable amount wrapping the givenVariableAmount
, calls toamount(java.util.random.RandomGenerator, T)
will always return wrapped amounts value.- Type Parameters:
T
- The seed object type- Parameters:
value
- The wrapped variable amount- Returns:
- A variable amount representation
-
amount
Gets an instance of the variable amount depending on the given random object and the seed object.- Parameters:
rand
- The random objectseed
- The seed object- Returns:
- The amount
-
flooredAmount
Gets the amount as if fromamount(RandomGenerator, Object)
but floored to the nearest integer equivalent.- Parameters:
rand
- The random objectseed
- The seed object- Returns:
- The floored amount
-