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