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 voidwrite(OutputStream out, DoubleChromosome data) Write the givenDoubleChromosometo the given output stream.static voidwrite(OutputStream out, DoubleChromosome data, String indent) Write the givenDoubleChromosometo the given output stream.static Writer<DoubleChromosome> writer()Return aWriterforDoubleChromosomeobjects.static Writer<DoubleChromosome> Return aWriterforDoubleChromosomeobjects.
-
Method Details
-
alleleWriter
Return the default double allele writer for theDoubleChromosome.- Returns:
- the default double allele writer
-
writer
Return aWriterforDoubleChromosomeobjects.- 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 givenalleleWriterisnull
-
writer
Return aWriterforDoubleChromosomeobjects.- Returns:
- a chromosome writer
-
type
-
write
public static void write(OutputStream out, DoubleChromosome data, String indent) throws XMLStreamException Write the givenDoubleChromosometo 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 thechromosomeor output stream isnull
-
write
Write the givenDoubleChromosometo 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 thechromosomeor output stream isnull
-