java.lang.Object
io.jenetics.xml.Writers.IntegerChromosome
- Enclosing class:
Writers
This class contains static writer methods for
XML output
IntegerChromosome
objects.
Writer code
final IntegerChromosome value = IntegerChromosome
.of(Integer.MIN_VALUE, Integer.MAX_VALUE, 3);
try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) {
Writers.IntegerChromosome.writer().write(value, xml);
}
<int-chromosome length="3">
<min>-2147483648</min>
<max>2147483647</max>
<alleles>
<allele>-1878762439</allele>
<allele>-957346595</allele>
<allele>-88668137</allele>
</alleles>
</int-chromosome>
-
Method Summary
Modifier and TypeMethodDescriptionReturn the default integer allele writer for theIntegerChromosome
.static void
write
(OutputStream out, IntegerChromosome data) Write the givenIntegerChromosome
to the given output stream.static void
write
(OutputStream out, IntegerChromosome data, String indent) Write the givenIntegerChromosome
to the given output stream.static Writer
<IntegerChromosome> writer()
Return aWriter
forIntegerChromosome
objects.static Writer
<IntegerChromosome> Return aWriter
forIntegerChromosome
objects.
-
Method Details
-
alleleWriter
Return the default integer allele writer for theIntegerChromosome
.- Returns:
- the default integer allele writer
-
writer
Return aWriter
forIntegerChromosome
objects.- Parameters:
alleleWriter
- the allele writer used for writing the integer allele. Might be useful for using different integer encodings.- Returns:
- a chromosome writer
- Throws:
NullPointerException
- if the givenalleleWriter
isnull
-
writer
Return aWriter
forIntegerChromosome
objects.- Returns:
- a chromosome writer
-
write
public static void write(OutputStream out, IntegerChromosome data, String indent) throws XMLStreamException Write the givenIntegerChromosome
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 givenIntegerChromosome
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
-