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 forIntegerChromosomeobjects.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 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>writer(Writer<? super Integer> alleleWriter)Return aWriterforIntegerChromosomeobjects.
-
-
-
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 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
public static Writer<IntegerChromosome> 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
public static void write(OutputStream out, IntegerChromosome data) throws XMLStreamException
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
-
-