Class Constant<T>

java.lang.Object
org.moeaframework.analysis.parameter.AbstractParameter<T>
org.moeaframework.analysis.parameter.Constant<T>
Type Parameters:
T - the type of this parameter
All Implemented Interfaces:
Parameter<T>, Named

public class Constant<T> extends AbstractParameter<T>
A parameter assigned a constant value.
  • Constructor Details

    • Constant

      public Constant(String name, T value)
      Constructs a new constant parameter.
      Parameters:
      name - the name of this parameter
      value - the constant value
  • Method Details

    • getValue

      public T getValue()
      Returns the constant value.
      Returns:
      the constant value
    • parse

      public T parse(String str)
      Description copied from interface: Parameter
      Parses this parameter value from the given string.
      Parameters:
      str - the string
      Returns:
      the parameter value
    • apply

      public void apply(Sample sample)
      Applies this constant to the given sample.
      Parameters:
      sample - thes ample
    • apply

      public void apply(Iterable<Sample> samples)
      Applies this constant to the given samples.
      Parameters:
      samples - the samples
    • encode

      public String encode(Tokenizer tokenizer)
      Description copied from interface: Parameter
      Encodes this parameter definition in a format suitable for storing in a file.
      Parameters:
      tokenizer - the tokenizer
      Returns:
      the string representation
    • decode

      public static Constant<String> decode(Tokenizer tokenizer, String line)
      Decodes the string representation of this parameter.
      Parameters:
      tokenizer - the tokenizer
      line - the string representation
      Returns:
      the decoded parameter
      Throws:
      InvalidParameterException - if the string representation is not a valid parameter