Class Readers.Genotypes

java.lang.Object
io.jenetics.xml.Readers.Genotypes
Enclosing class:
Readers

public static final class Readers.Genotypes extends Object
This class contains static reader methods for Genotype objects.

XML format

 
 <genotypes length="1">
     <genotype length="2" ngenes="5">
         <double-chromosome length="3">
             <min>0.0</min>
             <max>1.0</max>
             <alleles>
                 <allele>0.27251556008507416</allele>
                 <allele>0.003140816229067145</allele>
                 <allele>0.43947528327497376</allele>
             </alleles>
         </double-chromosome>
         <double-chromosome length="2">
             <min>0.0</min>
             <max>1.0</max>
             <alleles>
                 <allele>0.4026521545744768</allele>
                 <allele>0.36137605952663554</allele>
             <alleles>
         </double-chromosome>
     </genotype>
 </genotypes>
 
  • Method Details

    • reader

      public static <A, G extends Gene<A, G>, C extends Chromosome<G>> Reader<List<Genotype<G>>> reader(Reader<C> chromosomeReader)
      Return a genotype reader using the given chromosome reader.
      Type Parameters:
      A - the allele type
      G - the gene type
      C - the chromosome type
      Parameters:
      chromosomeReader - the underlying chromosome reader
      Returns:
      a genotype reader using the given chromosome reader
      Throws:
      NullPointerException - if the given chromosomeReader is null
    • read

      public static <A, G extends Gene<A, G>, C extends Chromosome<G>> List<Genotype<G>> read(InputStream in, Reader<? extends C> chromosomeReader) throws XMLStreamException
      Reads the genotypes by using the given chromosome reader.
      Type Parameters:
      A - the allele type
      G - the gene type
      C - the chromosome type
      Parameters:
      in - the input stream to read the genotype from
      chromosomeReader - the used chromosome reader
      Returns:
      a genotype by using the given chromosome reader
      Throws:
      XMLStreamException - if reading the genotype fails
      NullPointerException - if one of the arguments is null