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.
@FunctionalInterface public interface SeededVariableAmount<T>
Represents a value which may vary depending on a seed object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSeededVariableAmount.WrappedVariableAmount<T>ASeededVariableAmountwhich wraps anotherVariableAmountand defers all operations to the inner VariableAmount without the seed.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description doubleamount(Random 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, T)will always return the fixed value.default intflooredAmount(Random rand, T seed)Gets the amount as if fromamount(Random, 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, T)will always return wrapped amounts value.
-
-
-
Method Detail
-
fixed
static <T> SeededVariableAmount<T> fixed(double value)
Creates a new 'fixed' variable amount, calls toamount(java.util.Random, 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
static <T> SeededVariableAmount<T> wrapped(VariableAmount value)
Creates a new variable amount wrapping the givenVariableAmount, calls toamount(java.util.Random, 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
double amount(Random rand, T seed)
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
default int flooredAmount(Random rand, T seed)
Gets the amount as if fromamount(Random, Object)but floored to the nearest integer equivalent.- Parameters:
rand- The random objectseed- The seed object- Returns:
- The floored amount
-
-