Package io.jenetics.xml
Class Writers
- java.lang.Object
-
- io.jenetics.xml.Writers
-
public final class Writers extends Object
This class contains static fields and methods, for creating chromosome- and genotype writers for different gene types.This class also contains some helper methods, which makes it easier to write Jenetics domain objects to a given output stream.final Writer<Genotype<BitGene> bgw = Writers.Genotype.writer(Writers.BitChromosome.writer())); final Writer<Genotype<IntegerGene>> igw = Writers.Genotype.writer(Writers.IntegerChromosome.writer())); final Writer<Genotype<DoubleGene>> dgw = Writers.Genotype.writer(Writers.DoubleChromosome.writer()));
final List<Genotype<BitGene>> genotypes = ...; try (OutputStream out = Files.newOutputStream(Paths.get("path"))) { Writers.write(out, genotypes, Writers.BitChromosome.writer()); }
- Since:
- 3.9
- Version:
- 3.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Writers.BitChromosome
This class contains static writer methods forBitChromosome
objects.static class
Writers.BoundedChromosome
This class contains static writer methods forBoundedChromosome
objects.static class
Writers.CharacterChromosome
This class contains static writer methods forCharacterChromosome
objects.static class
Writers.DoubleChromosome
This class contains static writer methods forDoubleChromosome
objects.static class
Writers.Genotype
This class contains static writer methods forGenotype
objects.static class
Writers.Genotypes
This class contains static writer methods forGenotype
objects.static class
Writers.IntegerChromosome
This class contains static writer methods forIntegerChromosome
objects.static class
Writers.LongChromosome
This class contains static writer methods forLongChromosome
objects.static class
Writers.PermutationChromosome
This class contains static writer methods forPermutationChromosome
objects.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A,G extends Gene<A,G>,C extends Chromosome<G>>
voidwrite(OutputStream out, Collection<Genotype<G>> data, Writer<? super C> chromosomeWriter)
Write the givenGenotype
to the given output stream.
-
-
-
Method Detail
-
write
public static <A,G extends Gene<A,G>,C extends Chromosome<G>> void write(OutputStream out, Collection<Genotype<G>> data, Writer<? super C> chromosomeWriter) throws XMLStreamException
Write the givenGenotype
to the given output stream.- Type Parameters:
A
- the allele typeG
- the gene typeC
- the chromosome type- Parameters:
out
- the target output streamdata
- the genotypes to writechromosomeWriter
- the chromosome writer used to write the genotypes- Throws:
XMLStreamException
- if an error occurs while writing the chromosomeNullPointerException
- if the one of the arguments isnull
- See Also:
Writers.Genotypes.write(OutputStream, Collection, Writer)
-
-