Class Val<T>

java.lang.Object
io.jenetics.prog.op.Val<T>
Type Parameters:
T - the type of the constant value
All Implemented Interfaces:
Op<T>, Function<T[],T>, Supplier<Op<T>>
Direct Known Subclasses:
Const, EphemeralConst

public abstract sealed class Val<T> extends Object implements Op<T> permits Const<T>, EphemeralConst<T>
This is the sealed base class for unmodifiable values. The only subclasses of this type are Const and EphemeralConst.
Since:
5.0
Version:
7.0
See Also:
  • Method Details

    • name

      public final String name()
      Description copied from interface: Op
      Return the name of the operation.
      Specified by:
      name in interface Op<T>
      Returns:
      the name of the operation
    • value

      public abstract T value()
      Return the constant value.
      Returns:
      the constant value
    • apply

      public final T apply(T[] value)
      The apply method will always return the value().
      Specified by:
      apply in interface Function<T[],T>
      Parameters:
      value - the input parameters will be ignored
      Returns:
      always value()
    • arity

      public final int arity()
      The arity of Val objects is always zero.
      Specified by:
      arity in interface Op<T>
      Returns:
      always zero
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object