View Javadoc
1   package net.bmahe.genetics4j.core.chromosomes;
2   
3   /**
4    * Base interface for all chromosome types in the genetic algorithm framework.
5    * 
6    * <p>A chromosome represents a single component of genetic information within a genotype.
7    * Different chromosome implementations encode genetic information in various formats such as
8    * bit strings, integer arrays, floating-point vectors, or tree structures.
9    * 
10   * <p>This interface defines the minimal contract that all chromosome types must implement.
11   * Specific chromosome types extend this interface to provide type-specific operations
12   * and genetic operators.
13   * 
14   * @see net.bmahe.genetics4j.core.Genotype
15   * @see BitChromosome
16   * @see IntChromosome
17   * @see DoubleChromosome
18   * @see FloatChromosome
19   * @see TreeChromosome
20   */
21  public interface Chromosome {
22  
23  	/**
24  	 * Returns the number of alleles (genetic units) in this chromosome.
25  	 * 
26  	 * <p>The interpretation of an allele depends on the specific chromosome type:
27  	 * <ul>
28  	 * <li>For bit chromosomes: the number of bits</li>
29  	 * <li>For numeric chromosomes: the number of numeric values</li>
30  	 * <li>For tree chromosomes: the number of nodes in the tree</li>
31  	 * </ul>
32  	 * 
33  	 * @return the number of alleles in this chromosome, always positive
34  	 */
35  	public int getNumAlleles();
36  }