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 voidwrite(OutputStream out, IntegerChromosome data) Write the givenIntegerChromosometo the given output stream.static voidwrite(OutputStream out, IntegerChromosome data, String indent) Write the givenIntegerChromosometo the given output stream.static Writer<IntegerChromosome> writer()Return aWriterforIntegerChromosomeobjects.static Writer<IntegerChromosome> Return aWriterforIntegerChromosomeobjects.
-
Method Details
-
alleleWriter
Return the default integer allele writer for theIntegerChromosome.- Returns:
- the default integer allele writer
-
writer
Return aWriterforIntegerChromosomeobjects.- 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 givenalleleWriterisnull
-
writer
Return aWriterforIntegerChromosomeobjects.- Returns:
- a chromosome writer
-
write
public static void write(OutputStream out, IntegerChromosome data, String indent) throws XMLStreamException Write the givenIntegerChromosometo 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 givenIntegerChromosometo 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
-