Package io.jenetics.xml
Class Writers.IntegerChromosome
- java.lang.Object
-
- io.jenetics.xml.Writers.IntegerChromosome
-
- Enclosing class:
- Writers
public static final class Writers.IntegerChromosome extends Object
This class contains static writer methods forIntegerChromosome
objects.Writer code
XML outputfinal 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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Writer<Integer>
alleleWriter()
Return 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>
writer(Writer<? super Integer> alleleWriter)
Return aWriter
forIntegerChromosome
objects.
-
-
-
Method Detail
-
alleleWriter
public static Writer<Integer> alleleWriter()
Return the default integer allele writer for theIntegerChromosome
.- Returns:
- the default integer allele writer
-
writer
public static Writer<IntegerChromosome> writer(Writer<? super Integer> alleleWriter)
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
public static Writer<IntegerChromosome> 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
public static void write(OutputStream out, IntegerChromosome data) throws XMLStreamException
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
-
-