public final class EphemeralConst<T> extends Object implements Op<T>, Serializable
final Random random = ...;
final Op<Double> val = EphemeralConst.of(random::nextDouble());
Modifier and Type | Method and Description |
---|---|
T |
apply(T[] ts) |
int |
arity()
Return the arity of the operation function.
|
boolean |
equals(Object obj) |
Op<T> |
get()
Return a newly created, uninitialized constant of type
T . |
int |
hashCode() |
String |
name()
Return the name of the operation.
|
static <T> EphemeralConst<T> |
of(String name,
Supplier<T> supplier)
Create a new ephemeral constant with the given
name and value
supplier . |
static <T> EphemeralConst<T> |
of(Supplier<T> supplier)
Create a new ephemeral constant with the given value
supplier . |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isTerminal, of, of, of
public int arity()
Op
public static <T> EphemeralConst<T> of(String name, Supplier<T> supplier)
name
and value
supplier
. For every newly created operation tree, a new constant
value is chosen for this terminal operation. The value is than kept
constant for this tree.T
- the constant typename
- the name of the ephemeral constantsupplier
- the value supplierNullPointerException
- if one of the arguments is null
public static <T> EphemeralConst<T> of(Supplier<T> supplier)
supplier
.
For every newly created operation tree, a new constant value is chosen
for this terminal operation. The value is than kept constant for this tree.T
- the constant typesupplier
- the value supplierNullPointerException
- if the supplier
is null
© 2007-2018 Franz Wilhelmstötter (2018-10-28 17:23)