java.lang.Object
io.jenetics.xml.Writers.LongChromosome
- Enclosing class:
- Writers
This class contains static writer methods for
XML output
LongChromosome objects.
Writer code
final LongChromosome value = LongChromosome
.of(Long.MIN_VALUE, Long.MAX_VALUE, 3);
try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) {
Writers.LongChromosome.writer().write(value, xml);
}
<long-chromosome length="3">
<min>-9223372036854775808</min>
<max>9223372036854775807</max>
<alleles>
<allele>-1345217698116542402</allele>
<allele>-7144755673073475303</allele>
<allele>6053786736809578435</allele>
</alleles>
</long-chromosome>
-
Method Summary
Modifier and TypeMethodDescriptionReturn the default long allele writer for theIntegerChromosome.static voidwrite(OutputStream out, LongChromosome data) Write the givenLongChromosometo the given output stream.static voidwrite(OutputStream out, LongChromosome data, String indent) Write the givenLongChromosometo the given output stream.static Writer<LongChromosome>writer()Return aWriterforLongChromosomeobjects.static Writer<LongChromosome>Return aWriterforLongChromosomeobjects.
-
Method Details
-
alleleWriter
Return the default long allele writer for theIntegerChromosome.- Returns:
- the default long allele writer
-
writer
Return aWriterforLongChromosomeobjects.- 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 aWriterforLongChromosomeobjects.- Returns:
- a chromosome writer
-
write
public static void write(OutputStream out, LongChromosome data, String indent) throws XMLStreamException Write the givenLongChromosometo 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 givenLongChromosometo 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
-