Package io.jenetics.xml
Class Writers.LongChromosome
- java.lang.Object
-
- io.jenetics.xml.Writers.LongChromosome
-
- Enclosing class:
- Writers
public static final class Writers.LongChromosome extends Object
This class contains static writer methods forLongChromosome
objects.Writer code
XML outputfinal LongChromosome value = LongChromosome .of(Long.MIN_VALUE, Long.MAX_VALUE, 3); try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { Writers.LongChromosome.writer().write(value, xml); }
<long-chromosome length="3"> <min>-9223372036854775808</min> <max>9223372036854775807</max> <alleles> <allele>-1345217698116542402</allele> <allele>-7144755673073475303</allele> <allele>6053786736809578435</allele> </alleles> </long-chromosome>
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Writer<Long>
alleleWriter()
Return the default long allele writer for theIntegerChromosome
.static void
write(OutputStream out, LongChromosome data)
Write the givenLongChromosome
to the given output stream.static void
write(OutputStream out, LongChromosome data, String indent)
Write the givenLongChromosome
to the given output stream.static Writer<LongChromosome>
writer()
Return aWriter
forLongChromosome
objects.static Writer<LongChromosome>
writer(Writer<? super Long> alleleWriter)
Return aWriter
forLongChromosome
objects.
-
-
-
Method Detail
-
alleleWriter
public static Writer<Long> alleleWriter()
Return the default long allele writer for theIntegerChromosome
.- Returns:
- the default long allele writer
-
writer
public static Writer<LongChromosome> writer(Writer<? super Long> alleleWriter)
Return aWriter
forLongChromosome
objects.- 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 givenalleleWriter
isnull
-
writer
public static Writer<LongChromosome> writer()
Return aWriter
forLongChromosome
objects.- Returns:
- a chromosome writer
-
write
public static void write(OutputStream out, LongChromosome data, String indent) throws XMLStreamException
Write the givenLongChromosome
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, LongChromosome data) throws XMLStreamException
Write the givenLongChromosome
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
-
-