Class SampledInteger

java.lang.Object
org.moeaframework.analysis.parameter.AbstractParameter<Integer>
org.moeaframework.analysis.parameter.SampledInteger
All Implemented Interfaces:
NumericParameter<Integer>, Parameter<Integer>, SampledParameter<Integer>, Named

public class SampledInteger extends AbstractParameter<Integer> implements SampledParameter<Integer>, NumericParameter<Integer>
Parameter representing an Integer value, ranging from -2147483648 to 2147483647.
  • Constructor Details

    • SampledInteger

      public SampledInteger(String name, int lowerBound, int upperBound)
      Constructs a new integer parameter with the given sampling bounds.
      Parameters:
      name - the parameter name
      lowerBound - the lower bound
      upperBound - the upper bound
  • Method Details

    • getLowerBound

      public Integer getLowerBound()
      Description copied from interface: NumericParameter
      The lower bound of this parameter.
      Specified by:
      getLowerBound in interface NumericParameter<Integer>
      Returns:
      the lower bound
    • getUpperBound

      public Integer getUpperBound()
      Description copied from interface: NumericParameter
      The upper bound of this parameter.
      Specified by:
      getUpperBound in interface NumericParameter<Integer>
      Returns:
      the upper bound
    • parse

      public Integer parse(String str)
      Description copied from interface: Parameter
      Parses this parameter value from the given string.
      Specified by:
      parse in interface Parameter<Integer>
      Parameters:
      str - the string
      Returns:
      the parameter value
    • sample

      public void sample(Sample sample, double scale)
      Description copied from interface: SampledParameter
      Samples this parameter and assigns the value to the sample. The scale is a value between 0.0 and 1.0, typically supplied by a Sequence, used to generate the sampled value.

      When converting the scale to the parameter value, implementations are expected to provide equal weighting to each possible value, so that a value does not appear more or less often than any other value.

      Specified by:
      sample in interface SampledParameter<Integer>
      Parameters:
      sample - the sample
      scale - value between 0.0 and 1.0 used to generate the sample
    • encode

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

      public static SampledInteger 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