Package io.jenetics

Interface BoundedGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>>

All Superinterfaces:
Comparable<G>, Factory<G>, Gene<A,G>, Self<G>, Verifiable
All Known Subinterfaces:
NumericGene<N,G>
All Known Implementing Classes:
DoubleGene, IntegerGene, LongGene

public interface BoundedGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>> extends Gene<A,G>, Comparable<G>
Base interface for genes where the alleles are bound by a minimum and a maximum value.
Since:
1.6
Version:
7.0
See Also:
Implementation Requirements:
Jenetics requires that the individuals (Genotype and Phenotype) are not changed after they have been created. Therefore, all implementations of the BoundedGene interface must also be immutable.
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    compareTo(G other)
     
    default boolean
    Check if this object is valid.
    max()
    Return the allowed max value.
    default G
    max(G other)
    Return the maximum value of this and the given other value.
    min()
    Return the allowed min value.
    default G
    min(G other)
    Return the minimum value of this and the given other value.
    newInstance(A value)
    Create a new gene from the given value and the current bounds.

    Methods inherited from interface io.jenetics.util.Factory

    instances

    Methods inherited from interface io.jenetics.Gene

    allele, newInstance

    Methods inherited from interface io.jenetics.util.Self

    self
  • Method Details

    • min

      A min()
      Return the allowed min value.
      Returns:
      The allowed min value.
    • max

      A max()
      Return the allowed max value.
      Returns:
      The allowed max value.
    • isValid

      default boolean isValid()
      Description copied from interface: Verifiable
      Check if this object is valid.
      Specified by:
      isValid in interface Verifiable
      Returns:
      true if this object is valid, false otherwise.
    • compareTo

      default int compareTo(G other)
      Specified by:
      compareTo in interface Comparable<A extends Comparable<? super A>>
    • min

      default G min(G other)
      Return the minimum value of this and the given other value.
      Parameters:
      other - the other value
      Returns:
      the minimum value of this and the given other
      Throws:
      NullPointerException - if other is null
      Since:
      7.0
    • max

      default G max(G other)
      Return the maximum value of this and the given other value.
      Parameters:
      other - the other value
      Returns:
      the maximum value of this and the given other
      Throws:
      NullPointerException - if other is null
      Since:
      7.0
    • newInstance

      G newInstance(A value)
      Create a new gene from the given value and the current bounds.
      Specified by:
      newInstance in interface Gene<A extends Comparable<? super A>,G extends BoundedGene<A,G>>
      Parameters:
      value - the value of the new gene.
      Returns:
      a new gene with the given value.