java.lang.Object
io.jenetics.xml.Writers.DoubleChromosome
- Enclosing class:
Writers
This class contains static writer methods for
XML output
DoubleChromosome
objects.
Writer code
final DoubleChromosome value = DoubleChromosome.of(0.0, 1.0, 3);
try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) {
Writers.DoubleChromosome.writer().write(value, xml);
}
<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>
-
Method Summary
Modifier and TypeMethodDescriptionReturn the default double allele writer for theDoubleChromosome
.type()
static void
write
(OutputStream out, DoubleChromosome data) Write the givenDoubleChromosome
to the given output stream.static void
write
(OutputStream out, DoubleChromosome data, String indent) Write the givenDoubleChromosome
to the given output stream.static Writer
<DoubleChromosome> writer()
Return aWriter
forDoubleChromosome
objects.static Writer
<DoubleChromosome> Return aWriter
forDoubleChromosome
objects.
-
Method Details
-
alleleWriter
Return the default double allele writer for theDoubleChromosome
.- Returns:
- the default double allele writer
-
writer
Return aWriter
forDoubleChromosome
objects.- Parameters:
alleleWriter
- the allele writer used for writing the long allele. Might be useful for using different long encodings.- Returns:
- a chromosome writer
- Throws:
NullPointerException
- if the givenalleleWriter
isnull
-
writer
Return aWriter
forDoubleChromosome
objects.- Returns:
- a chromosome writer
-
type
-
write
public static void write(OutputStream out, DoubleChromosome data, String indent) throws XMLStreamException Write the givenDoubleChromosome
to the given output stream.- Parameters:
out
- the target output streamdata
- the chromosome to writeindent
- the XML level indentation- Throws:
XMLStreamException
- if an error occurs while writing the chromosomeNullPointerException
- if thechromosome
or output stream isnull
-
write
Write the givenDoubleChromosome
to the given output stream.- Parameters:
out
- the target output streamdata
- the chromosome to write- Throws:
XMLStreamException
- if an error occurs while writing the chromosomeNullPointerException
- if thechromosome
or output stream isnull
-