public static final class Writers.IntegerChromosome extends Object
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>
Modifier and Type | Method and Description |
---|---|
static Writer<Integer> |
alleleWriter()
Return the default integer allele writer for the
IntegerChromosome . |
static void |
write(OutputStream out,
IntegerChromosome data)
Write the given
IntegerChromosome to the given
output stream. |
static void |
write(OutputStream out,
IntegerChromosome data,
String indent)
Write the given
IntegerChromosome to the given
output stream. |
static Writer<IntegerChromosome> |
writer()
Return a
Writer for IntegerChromosome
objects. |
static Writer<IntegerChromosome> |
writer(Writer<? super Integer> alleleWriter)
Return a
Writer for IntegerChromosome
objects. |
public static Writer<Integer> alleleWriter()
IntegerChromosome
.public static Writer<IntegerChromosome> writer(Writer<? super Integer> alleleWriter)
Writer
for IntegerChromosome
objects.alleleWriter
- the allele writer used for writing the integer
allele. Might be useful for using different integer
encodings.NullPointerException
- if the given alleleWriter
is
null
public static Writer<IntegerChromosome> writer()
Writer
for IntegerChromosome
objects.public static void write(OutputStream out, IntegerChromosome data, String indent) throws XMLStreamException
IntegerChromosome
to the given
output stream.out
- the target output streamdata
- the chromosome to writeindent
- the XML level indentationXMLStreamException
- if an error occurs while writing the
chromosomeNullPointerException
- if the chromosome
or output
stream is null
public static void write(OutputStream out, IntegerChromosome data) throws XMLStreamException
IntegerChromosome
to the given
output stream.out
- the target output streamdata
- the chromosome to writeXMLStreamException
- if an error occurs while writing the
chromosomeNullPointerException
- if the chromosome
or output
stream is null
© 2007-2018 Franz Wilhelmstötter (2018-02-14 08:27)