public static final class Writers.Genotype extends Object
Genotype
objects.
Writer code
final Genotype<DoubleGene> gt = Genotype.of(
DoubleChromosome.of(0.0, 1.0, 3),
DoubleChromosome.of(0.0, 1.0, 2)
);
final Writer<Genotype<DoubleGene>> writer =
Writers.Genotype.writer(Writers.DoubleChromosome.writer());
try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) {
writer.write(value, xml);
}
<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>
Modifier and Type | Method and Description |
---|---|
static <A,G extends Gene<A,G>,C extends Chromosome<G>> |
write(OutputStream out,
Genotype<G> data,
String indent,
Writer<? super C> chromosomeWriter)
Write the given
Genotype to the given output
stream. |
static <A,G extends Gene<A,G>,C extends Chromosome<G>> |
write(OutputStream out,
Genotype<G> data,
Writer<? super C> chromosomeWriter)
Write the given
Genotype to the given output
stream. |
static <A,G extends Gene<A,G>,C extends Chromosome<G>> |
writer(Writer<? super C> writer)
Create a writer for genotypes of arbitrary chromosomes.
|
public static <A,G extends Gene<A,G>,C extends Chromosome<G>> Writer<Genotype<G>> writer(Writer<? super C> writer)
Writer
.A
- the allele typeG
- the gene typeC
- the chromosome typewriter
- the chromosome writerNullPointerException
- if the given chromosome writer
is
null
public static <A,G extends Gene<A,G>,C extends Chromosome<G>> void write(OutputStream out, Genotype<G> data, String indent, Writer<? super C> chromosomeWriter) throws XMLStreamException
Genotype
to the given output
stream.A
- the allele typeG
- the gene typeC
- the chromosome typeout
- the target output streamdata
- the genotype to writeindent
- the XML level indentationchromosomeWriter
- the chromosome writer used to write the
genotypesXMLStreamException
- if an error occurs while writing the
chromosomeNullPointerException
- if the one of the arguments is
null
public static <A,G extends Gene<A,G>,C extends Chromosome<G>> void write(OutputStream out, Genotype<G> data, Writer<? super C> chromosomeWriter) throws XMLStreamException
Genotype
to the given output
stream.A
- the allele typeG
- the gene typeC
- the chromosome typeout
- the target output streamdata
- the genotype to writechromosomeWriter
- the chromosome writer used to write the
genotypesXMLStreamException
- if an error occurs while writing the
chromosomeNullPointerException
- if the one of the arguments is
null
© 2007-2017 Franz Wilhelmstötter (2017-08-22 19:30)