java.lang.Object
io.jenetics.prog.op.Val<T>
io.jenetics.prog.op.Const<T>
- All Implemented Interfaces:
Op<T>
,Serializable
,Function<T[],
,T> Supplier<Op<T>>
Represents an operation which always returns the same, constant, value. To
improve readability, constants may have a name. If a name is given, this name
is used when printing the program tree. The
Const
operation is a
terminal operation.
final static Op<Double> PI = Const.of("π", Math.PI);
final static Op<Double> ONE = Const.of(1.0);
- Since:
- 3.9
- Version:
- 7.0
- See Also:
-
Method Details
-
value
Description copied from class:Val
Return the constant value. -
toString
-
of
Return a new constant with the given name and value.- Type Parameters:
T
- the constant type- Parameters:
name
- the constant namevalue
- the constant value- Returns:
- a new constant
- Throws:
NullPointerException
- if the given constantname
isnull
-
of
Return a new constant with the given value.- Type Parameters:
T
- the constant type- Parameters:
value
- the constant value- Returns:
- a new constant
-