Package io.jenetics.xml
Class Writers.DoubleChromosome
- java.lang.Object
-
- io.jenetics.xml.Writers.DoubleChromosome
-
- Enclosing class:
- Writers
public static final class Writers.DoubleChromosome extends Object
This class contains static writer methods forDoubleChromosomeobjects.Writer code
XML outputfinal DoubleChromosome value = DoubleChromosome.of(0.0, 1.0, 3); try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { Writers.DoubleChromosome.writer().write(value, xml); }<double-chromosome length="3"> <min>0.0</min> <max>1.0</max> <alleles> <allele>0.27251556008507416</allele> <allele>0.003140816229067145</allele> <allele>0.43947528327497376</allele> </alleles> </double-chromosome>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Writer<Double>alleleWriter()Return the default double allele writer for theDoubleChromosome.Class<DoubleChromosome>type()static voidwrite(OutputStream out, DoubleChromosome data)Write the givenDoubleChromosometo the given output stream.static voidwrite(OutputStream out, DoubleChromosome data, String indent)Write the givenDoubleChromosometo the given output stream.static Writer<DoubleChromosome>writer()Return aWriterforDoubleChromosomeobjects.static Writer<DoubleChromosome>writer(Writer<? super Double> alleleWriter)Return aWriterforDoubleChromosomeobjects.
-
-
-
Method Detail
-
alleleWriter
public static Writer<Double> alleleWriter()
Return the default double allele writer for theDoubleChromosome.- Returns:
- the default double allele writer
-
writer
public static Writer<DoubleChromosome> writer(Writer<? super Double> alleleWriter)
Return aWriterforDoubleChromosomeobjects.- 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
public static Writer<DoubleChromosome> writer()
Return aWriterforDoubleChromosomeobjects.- Returns:
- a chromosome writer
-
type
public Class<DoubleChromosome> type()
-
write
public static void write(OutputStream out, DoubleChromosome data, String indent) throws XMLStreamException
Write the givenDoubleChromosometo 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, DoubleChromosome data) throws XMLStreamException
Write the givenDoubleChromosometo 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
-
-