Interface TreeGene<A,G extends TreeGene<A,G>>

All Superinterfaces:
Factory<G>, FlatTree<A,G>, Gene<A,G>, Iterable<G>, Self<G>, Tree<A,G>, Verifiable
All Known Implementing Classes:
AbstractTreeGene, ProgramGene

public interface TreeGene<A,G extends TreeGene<A,G>> extends Gene<A,G>, FlatTree<A,G>
Representation of tree shaped gene. Since the genes are part of a chromosome, they are implementing the FlatTree interface, which makes the required storage layout explicit.
Since:
3.9
Version:
6.0
  • Method Details

    • value

      default A value()
      Description copied from interface: Tree
      Return the value of the current Tree node. The value may be null.
      Specified by:
      value in interface Tree<A,G extends TreeGene<A,G>>
      Returns:
      the value of the current Tree node
    • newInstance

      G newInstance(A allele, int childOffset, int childCount)
      Return a new tree gene with the given allele and the local tree structure.
      Parameters:
      allele - the actual gene allele
      childOffset - the offset of the first node child within the chromosome
      childCount - the number of children of the new tree gene
      Returns:
      a new tree gene with the given parameters
      Throws:
      IllegalArgumentException - if the childCount is smaller than zero
    • newInstance

      default G newInstance(FlatTree<? extends A,?> tree)
      Return a new tree gene from the given flat tree node.
      Parameters:
      tree - the flat tree node
      Returns:
      a new tree gene from the given flat tree node
      Throws:
      NullPointerException - if the given tree node is null
      Since:
      6.0