Class IntegerGenotype

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Integer>, Collection<Integer>, List<Integer>, RandomAccess, Genotype, ListGenotype<Integer>
Direct Known Subclasses:
IntegerMapGenotype, SelectGenotype, SelectMapGenotype

public class IntegerGenotype extends ArrayList<Integer> implements ListGenotype<Integer>
The IntegerGenotype is a Genotype that consists of integer values.
See Also:
  • Field Details

  • Constructor Details

    • IntegerGenotype

      public IntegerGenotype(int lowerBound, int upperBound)
      Constructs a IntegerGenotype with a specified lower and upper bound for all values.
      Parameters:
      lowerBound - the lower bound
      upperBound - the upper bound
    • IntegerGenotype

      public IntegerGenotype(Bounds<Integer> bounds)
      Constructs a IntegerGenotype with the given Bounds.
      Parameters:
      bounds - the bounds
  • Method Details

    • getLowerBound

      public int getLowerBound(int index)
      Returns the lower bound for the i-th element.
      Parameters:
      index - the i-th element
      Returns:
      the lower bound of the i-th element
    • getUpperBound

      public int getUpperBound(int index)
      Returns the upper bound for the i-th element.
      Parameters:
      index - the i-th element
      Returns:
      the upper bound of the i-th element
    • newInstance

      public <G extends Genotype> G newInstance()
      Description copied from interface: Genotype
      Constructs a new (empty) instance of this Genotype.
      Specified by:
      newInstance in interface Genotype
      Type Parameters:
      G - the type of genotype for an implicit cast
      Returns:
      new instance of the genotype
    • init

      public void init(Random random, int n)
      Initialize this genotype with n random values.
      Parameters:
      random - the random number generator
      n - the number of elements in the resulting genotype