java.lang.Object
io.jenetics.xml.Writers
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
Modifier and TypeClassDescriptionstatic final class
This class contains static writer methods forBitChromosome
objects.static final class
This class contains static writer methods forBoundedChromosome
objects.static final class
This class contains static writer methods forCharacterChromosome
objects.static final class
This class contains static writer methods forDoubleChromosome
objects.static final class
This class contains static writer methods forGenotype
objects.static final class
This class contains static writer methods forGenotype
objects.static final class
This class contains static writer methods forIntegerChromosome
objects.static final class
This class contains static writer methods forLongChromosome
objects.static final class
This class contains static writer methods forPermutationChromosome
objects. -
Method Summary
Modifier and TypeMethodDescriptionstatic <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 Details
-
write
public static <A,G extends Gene<A, void writeG>, C extends Chromosome<G>> (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:
-