diff --git a/buildSrc/src/main/java/io/jenetics/gradle/Colorizer.java b/buildSrc/src/main/java/io/jenetics/gradle/Colorizer.java
index 8cf573cad7..c9ca10570c 100644
--- a/buildSrc/src/main/java/io/jenetics/gradle/Colorizer.java
+++ b/buildSrc/src/main/java/io/jenetics/gradle/Colorizer.java
@@ -47,10 +47,10 @@ public final class Colorizer extends SimpleFileVisitor{@code
+ // Original start tag: {@snippet lang="java":
private static final String START_TAG = "
";
private File _baseDir;
diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/MLEvolutionStrategy.java b/jenetics.ext/src/main/java/io/jenetics/ext/MLEvolutionStrategy.java
index 708e26d94a..9def6989c7 100644
--- a/jenetics.ext/src/main/java/io/jenetics/ext/MLEvolutionStrategy.java
+++ b/jenetics.ext/src/main/java/io/jenetics/ext/MLEvolutionStrategy.java
@@ -31,21 +31,21 @@
/**
* Setup for a (μ, λ)-Evolution Strategy. Applying this setup is done in the
* following way.
- *
+ // Original end tag: }
private static final String END_TAG = "";
- // Original end tag: }
{@code
+ * {@snippet lang="java":
* final var engine = Engine.builder(problem)
* .setup(new MLEvolutionStrategy<>(μ, λ, p)
* .build();
- * }
+ * }
*
* And is equivalent to the following builder setup.
- * {@code
+ * {@snippet lang="java":
* final var engine = Engine.builder(problem)
* .populationSize(λ)
* .survivorsSize(0)
* .offspringSelector(new TruncationSelector<>(μ))
* .alterers(new Mutator<>(p))
* .build();
- * }
+ * }
*
* @param {@code
+ * {@snippet lang="java":
* final var engine = Engine.builder(problem)
* .setup(new MpLEvolutionStrategy<>(μ, λ, p)
* .build();
- * }
+ * }
*
* And is equivalent to the following builder setup.
- * {@code
+ * {@snippet lang="java":
* final var engine = Engine.builder(problem)
* .populationSize(λ)
* .survivorsSize(μ)
* .offspringSelector(new TruncationSelector<>(μ))
* .alterers(new Mutator<>(p))
* .build();
- * }
+ * }
*
* @param {@code
+ * {@snippet lang="java":
* final Tree t1 = root();
* final Tree, ?> t2 = root();
- * }
+ * }
* This method is also an alias for {@link #gene()}, which returns the
* first gene of the chromosome.
*
diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/WeaselMutator.java b/jenetics.ext/src/main/java/io/jenetics/ext/WeaselMutator.java
index 634576a2c2..a5fddec4e0 100644
--- a/jenetics.ext/src/main/java/io/jenetics/ext/WeaselMutator.java
+++ b/jenetics.ext/src/main/java/io/jenetics/ext/WeaselMutator.java
@@ -44,7 +44,7 @@
* genotype in the population with the given mutation probability.
*
{@code + * {@snippet lang="java": * final Engine+ * } * * @see Weasel program * @see WeaselSelector diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/WeaselProgram.java b/jenetics.ext/src/main/java/io/jenetics/ext/WeaselProgram.java index 2c7d2fe960..efadba9ea7 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/WeaselProgram.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/WeaselProgram.java @@ -29,11 +29,11 @@ * Weasel program * algorithm. * - *engine = Engine.builder(problem) * // Set the 'WeaselSelector'. * .selector(new WeaselSelector<>()) @@ -53,7 +53,7 @@ * // Set the 'WeaselMutator'. * .alterers(new WeaselMutator<>(0.05)) * .build(); - * }
{@code + * {@snippet lang="java": * final Engine+ * } * * @see WeaselSelector * @see WeaselMutator diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/WeaselSelector.java b/jenetics.ext/src/main/java/io/jenetics/ext/WeaselSelector.java index d9f0a04a40..f3b31dde5b 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/WeaselSelector.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/WeaselSelector.java @@ -42,7 +42,7 @@ * instances of the best {@link Phenotype}. * * {@link io.jenetics.engine.Engine} setup for the Weasel program: - *engine = Engine.builder(problem) * .setup(new WeaselProgram<>()) * .build(); - * }
{@code + * {@snippet lang="java": * final Engine+ * } * * @see Weasel program * @see WeaselMutator diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/engine/ConcatEngine.java b/jenetics.ext/src/main/java/io/jenetics/ext/engine/ConcatEngine.java index b142157016..21c1f6126e 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/engine/ConcatEngine.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/engine/ConcatEngine.java @@ -61,7 +61,7 @@ * Concatenating evolution engines might be useful, if you want to explore your * search space with random search first and then start the real GA * search. - *engine = Engine.builder(problem) * // Set the 'WeaselSelector'. * .selector(new WeaselSelector<>()) @@ -51,7 +51,7 @@ * // Set the 'WeaselMutator'. * .alterers(new WeaselMutator<>(0.05)) * .build(); - * }
{@code + * {@snippet lang="java": * final Problem+ * } * * An essential part, when concatenating evolution engines, is to make sure your * engines are creating limited evolution streams. This is what diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/engine/CyclicEngine.java b/jenetics.ext/src/main/java/io/jenetics/ext/engine/CyclicEngine.java index 2cb984807f..b39502e426 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/engine/CyclicEngine.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/engine/CyclicEngine.java @@ -57,7 +57,7 @@ * The {@code CyclicEngine} allows to do a broad search-fine search-cycle * as long as you want. * - *problem = Problem.of( * v -> Math.sin(v[0])*Math.cos(v[1]), * Codecs.ofVector(DoubleRange.of(0, 2*Math.PI), 2) @@ -90,7 +90,7 @@ * * System.out.println(result + ": " + * problem.fitness().apply(problem.codec().decode(result))); - * }
{@code + * {@snippet lang="java": * final Problem+ * } * * When using a {@code CyclicEnginePool}, you have to limit the final evolution * stream, additionally to the defined limits on the used partial engines. diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Bnf.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Bnf.java index fc08b26393..33a45f110a 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Bnf.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Bnf.java @@ -32,7 +32,7 @@ * grammars in * BNF * format. - *problem = Problem.of( * v -> Math.sin(v[0])*Math.cos(v[1]), * Codecs.ofVector(DoubleRange.of(0, 2*Math.PI), 2) @@ -87,7 +87,7 @@ * * System.out.println(result + ": " + * problem.fitness().apply(problem.codec().decode(result))); - * }
{@code + * {@snippet lang="java": * final Cfg+ * } * * @author Franz Wilhelmstötter * @since 7.1 @@ -68,12 +68,12 @@ static boolean isIdChar(final char c) { * Parses the given BNF {@code grammar} string to a {@link Cfg} object. The * following example shows the grammar of a simple arithmetic expression. * - *grammar = Bnf.parse(""" * ::= | | '(' ')' * ::= + | - | * | / @@ -40,7 +40,7 @@ * ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 * """ * ); - * }
{@code + * {@snippet lang="java": *+ * } * * @param grammar the BNF {@code grammar} string * @return the parsed {@code BNF} object diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/BnfParser.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/BnfParser.java index 5ffd9fe6c8..bb34ab9cb7 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/BnfParser.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/BnfParser.java @@ -43,7 +43,7 @@ /** * Parser for BNF grammars. * - *::= | | '(' ')' * ::= + | - | * | / * ::= x | y * ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 - * }
{@code + * {@snippet lang="java": * rulelist: rule_* EOF; * rule: lhs ASSIGN rhs; * lhs: id; @@ -54,7 +54,7 @@ * text: STRING | QUOTED_STRING; * id: LT ruleid GT; * ruleid: ID; - * }+ * } * * The BNF object is build from the following classes. *
{@code + * {@snippet lang="java": * ASSIGN: '::='; * BAR: '|'; * GT: '>'; @@ -46,7 +46,7 @@ * ID: ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'-')+; * STRING: ( '%s' | '%i' )? '"' ( ~ '"' )* '"'; * WS: [ \r\n\t] -> skip; - * }+ * } * * @author Franz Wilhelmstötter * @since 7.1 diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Cfg.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Cfg.java index 96bc49a552..f53f871129 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Cfg.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Cfg.java @@ -68,7 +68,7 @@ * * * You can easily create a Cfg object from a given BNF grammar. - *
{@code + * {@snippet lang="java": * final Cfg+ * } * * It is also possible to create the grammar above programmatically. - *grammar = Bnf.parse(""" * ::= | | '(' ')' * ::= + | - | * | / @@ -76,10 +76,10 @@ * ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 * """ * ); - * }
{@code + * {@snippet lang="java": * final Cfg+ * } * * @see Bnf#parse(String) * diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Codons.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Codons.java index fb9e14284b..bbc1d42976 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Codons.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Codons.java @@ -38,7 +38,7 @@ * indexes are needed, the values are read from the beginning again. You have * the possibility to create a {@code Codons} object from different chromosome * types. - *grammar = Cfg.of( * R("expr", * E(NT("num")), @@ -94,7 +94,7 @@ * E(T("8")), E(T("9")) * ) * ); - * }
{@code + * {@snippet lang="java": * // Create 'classic' codons from a bit-chromosome, where * // the genes are split into 8-bit junks and converted * // into unsigned int values. @@ -47,7 +47,7 @@ * // Creating a codons object from an integer chromosome. * final var ich = IntegerChromosome.of(IntRange.of(0, 256), 1_000); * final var codons = Codons.ofIntegerGenes(ich); - * }+ * } * * @author Franz Wilhelmstötter * @since 7.1 @@ -85,9 +85,9 @@ public int next(final Rule> rule, final int bound) { * Creates a new, classical codons object from the given bit-genes. * The genes is split into 8-bit chunks and converted into an unsigned * {@code int[]} array. - *
{@code + * {@snippet lang="java": * final Codons codons = Codons.ofBitGenes(BitChromosome.of(10_000)); - * }+ * } * * @param genes the genes used for creating the codon object * @return a new codons object @@ -123,10 +123,10 @@ static byte[] toByteArray(final BaseSeq
{@code + * {@snippet lang="java": * final var chromosome = IntegerChromosome.of(IntRange.of(0, 256), 1_000); * final var codons = Codons.ofIntegerGenes(chromosome); - * }+ * } * * @param genes the genes used for creating the codon object * @return a new codons object diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/DerivationTreeGenerator.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/DerivationTreeGenerator.java index d7033a0f7e..cda8c404bc 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/DerivationTreeGenerator.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/DerivationTreeGenerator.java @@ -31,7 +31,7 @@ /** * Standard implementation of a derivation-tree generator. The following code * snippet lets you generate a derivation tree from a given grammar. - *
{@code + * {@snippet lang="java": * final Cfg+ * } * * @see SentenceGenerator * diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Mappers.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Mappers.java index bdb8fb1ef2..730dbcacd1 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Mappers.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/Mappers.java @@ -35,14 +35,14 @@ * This class defines factories for different CFG ↔ Chromosome mappings * (encodings). The classical mapping codec, with a bit-chromosome can be created * in the following way. - *cfg = Bnf.parse(""" * ::= ( ) | | | ( , ) * ::= FUN1 | FUN2 @@ -48,7 +48,7 @@ * 1_000 * ); * final Tree , ?> tree = generator.generate(cfg); - * }
{@code + * {@snippet lang="java": * final Cfg+ * } * This codec creates a mapping for the given grammar {@code cfg} and uses * bit-chromosomes with length {@code 1000}. The result of the mapping will be a * list of terminal symbols which has been created by the given @@ -67,14 +67,14 @@ private Mappers() { * 8-bit junks, as described in * Grammatical Evolution by Michael O’Neill and Conor Ryan. * - *cfg = ...; * final Codec >, BitGene> codec = singleBitChromosomeMapper( * cfg, * 1000, * index -> new SentenceGenerator<>(index, 1000) * ); - * }
{@code + * {@snippet lang="java": * final Cfg+ * } * * @see #singleIntegerChromosomeMapper(Cfg, IntRange, IntRange, Function) * @@ -105,7 +105,7 @@ private Mappers() { * The only difference is that the codons are encoded directly, via an * integer-chromosome, so that no gene split is necessary. * - *cfg = ...; * final Codec >, BitGene> codec = singleBitChromosomeMapper( * cfg, * 1000, * index -> new SentenceGenerator<>(index, 1000) * ); - * }
{@code + * {@snippet lang="java": * final Cfg+ * } * * @param cfg the encoding grammar * @param range the value range of the integer genes @@ -144,7 +144,7 @@ private Mappers() { * The only difference is that the codons are encoded directly, via an * integer-chromosome, so that no gene split is necessary. * - *cfg = ...; * final Codec >, IntegerGene> codec = singleIntegerChromosomeMapper( * cfg, @@ -113,7 +113,7 @@ private Mappers() { * IntRange.of(100), // Length (range) ot the chromosome. * index -> new SentenceGenerator<>(index, 1000) * ); - * }
{@code + * {@snippet lang="java": * final Cfg+ * } * * @param cfg the encoding grammar * @param range the value range of the integer genes @@ -182,28 +182,28 @@ private Mappers() { * every rule. The length of the chromosome is defined as a function of the * encoded rules. This means that the following CFG, * - *cfg = ...; * final Codec >, IntegerGene> codec = singleIntegerChromosomeMapper( * cfg, @@ -152,7 +152,7 @@ private Mappers() { * 100, // Length (range) ot the chromosome. * index -> new SentenceGenerator<>(index, 1000) * ); - * }
{@code + * {@snippet lang="java": * (0) (1) * (0)+ * } * * will be represented by the following {@link Genotype} - *::= ( ) | * (0) (1) (2) (3) * (1) ::= + | - | * | / * (0) (1) (2) (3) (4) * (2) ::= x | 1 | 2 | 3 | 4 - * }
{@code + * {@snippet lang="java": * Genotype.of( * IntegerChromosome.of(IntRange.of(0, 2), length.apply(cfg.rules().get(0))), * IntegerChromosome.of(IntRange.of(0, 4), length.apply(cfg.rules().get(1))), * IntegerChromosome.of(IntRange.of(0, 5), length.apply(cfg.rules().get(2))) * ) - * }+ * } * * The {@code length} function lets you defining the number of codons as * function of the rule the chromosome is encoding. * - *
{@code + * {@snippet lang="java": * final Cfg+ * } * * @param cfg the encoding grammar * @param length the length of the chromosome which is used for selecting diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/MultiIntegerChromosomeMapper.java b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/MultiIntegerChromosomeMapper.java index 06b774e4dd..24ef9c0eb6 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/grammar/MultiIntegerChromosomeMapper.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/grammar/MultiIntegerChromosomeMapper.java @@ -43,28 +43,28 @@ * every rule. The length of the chromosome is defined as a function of the * encoded rules. This means that the following CFG, * - *cfg = Bnf.parse(...); * final Codec >, IntegerGene> codec = multiIntegerChromosomeMapper( * cfg, @@ -214,7 +214,7 @@ private Mappers() { * // with a maximal sentence length of 500. * index -> new SentenceGenerator<>(index, 500) * ); - * }
{@code + * {@snippet lang="java": * (0) (1) * (0)+ * } * * will be represented by the following {@link Genotype} - *::= ( ) | * (0) (1) (2) (3) * (1) ::= + | - | * | / * (0) (1) (2) (3) (4) * (2) ::= x | 1 | 2 | 3 | 4 - * }
{@code + * {@snippet lang="java": * Genotype.of( * IntegerChromosome.of(IntRange.of(0, 2), length.apply(cfg.rules().get(0))), * IntegerChromosome.of(IntRange.of(0, 4), length.apply(cfg.rules().get(1))), * IntegerChromosome.of(IntRange.of(0, 5), length.apply(cfg.rules().get(2))) * ) - * }+ * } * * The {@code length} function lets you defining the number of codons as * function of the rule the chromosome is encoding. * - *
{@code + * {@snippet lang="java": * final Cfg+ * } * * @paramcfg = Bnf.parse(...); * final Codec >, IntegerGene> codec = new Mapper<>( * cfg, @@ -75,7 +75,7 @@ * // with a maximal sentence length of 5,000. * index -> new SentenceGenerator<>(index, 5_000) * ); - * }
* The following code snippet shows how to create a random sentence from a * given grammar: - *
{@code + * {@snippet lang="java": * final Cfg+ * } * Some sample output: - *cfg = Bnf.parse(""" * ::= ( ) | | | ( , ) * ::= FUN1 | FUN2 @@ -60,9 +60,9 @@ * .collect(Collectors.joining()); * * System.out.println(string); - * }
{@code + * {@snippet lang="java": * > ((x-FUN1(5,5))+8) * > (FUN2(y,5)-FUN2(0,x)) * > x @@ -71,7 +71,7 @@ * > FUN2(y,FUN2((FUN1(5,FUN1(y,2))*9),y)) * > ((FUN1(x,5)*9)*(x/(y*FUN2(x,y)))) * > (9-(y*(x+x))) - * > }+ * > } * * @see DerivationTreeGenerator * diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/internal/util/FormulaParser.java b/jenetics.ext/src/main/java/io/jenetics/ext/internal/util/FormulaParser.java index 46a526fad1..a39d47c05f 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/internal/util/FormulaParser.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/internal/util/FormulaParser.java @@ -76,7 +76,7 @@ * grammar, where the output is already a list of tokens (aka sentence). The * following example parser can be used to parse arithmetic expressions. * - *
{@code + * {@snippet lang="java": * final FormulaParser+ * } * This parser allows you to parse the following token list - *parser = FormulaParser. builder() * // Structural tokens. * .lparen("(") @@ -91,17 +91,17 @@ * .identifiers("x", "y", "z") * .functions("pow", "sin", "cos") * .build(); - * }
{@code + * {@snippet lang="java": * final List+ * } * which will result in the following parsed tree: - *tokens = List.of( * "x", "*", "x", "+", "sin", "(", "z", ")", "-", "cos", "(", "x", * ")", "+", "y", "/", "z", "-", "pow", "(", "z", ",", "x", ")" * ); * final Tree tree = parser.parse(tokens); - * }
{@code + * {@snippet lang="java": * "-" * ├── "+" * │ ├── "-" @@ -119,7 +119,7 @@ * └── "pow" * ├── "z" * └── "x" - * }+ * } * Note that the generated (parsed) tree is of type {@code Tree
{@code + * {@snippet lang="java": * final Tree+ * } * * @param, ?> tree = formula.parse( * tokens, * (token, type) -> switch (token) { @@ -144,7 +144,7 @@ * : throw new IllegalArgumentException("Unknown token: " + token); * } * ); - * }
{@code + * {@snippet lang="java": * final ElementComparator+ * } * * @paramcomp = * (u, v, i) -> Double.compare(u[i], v[i]); - * }
{@code + * {@snippet lang="java": * final ElementComparator+ * } * * @param u the first vector * @param v the second vector diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/moea/ElementDistance.java b/jenetics.ext/src/main/java/io/jenetics/ext/moea/ElementDistance.java index e9e8a7220c..8a35d1e990 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/moea/ElementDistance.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/moea/ElementDistance.java @@ -26,9 +26,9 @@ * Defines the distance of two elements of a given vector type {@code V}. * The following example creates an {@code ElementDistance} function for a * {@code double[] array}: - *comp = * (u, v, i) -> Double.compare(u[i], v[i]); - * }
{@code + * {@snippet lang="java": * final ElementDistance+ * } * * @paramdist = (u, v, i) -> u[i] - v[i]; - * }
{@code + * {@snippet lang="java": * final ElementDistance+ * } * * @param u the first vector * @param v the second vector diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/moea/MOEA.java b/jenetics.ext/src/main/java/io/jenetics/ext/moea/MOEA.java index 684d20cf83..56253d93c9 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/moea/MOEA.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/moea/MOEA.java @@ -39,7 +39,7 @@ * Collectors for collecting final pareto-set for multi-objective * optimization. * - *dist = (u, v, i) -> u[i] - v[i]; - * }
{@code + * {@snippet lang="java": * final Problem+ * } * * * @author Franz Wilhelmstötter diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/moea/NSGA2Selector.java b/jenetics.ext/src/main/java/io/jenetics/ext/moea/NSGA2Selector.java index f025a30d19..1abc8bc4d4 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/moea/NSGA2Selector.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/moea/NSGA2Selector.java @@ -67,14 +67,14 @@ public class NSGA2Selector< * Creates a new {@code NSGA2Selector} with the functions needed for * handling the multi-objective result type {@code C}. For the {@link Vec} * classes, a selector is created like in the following example: - *> problem = Problem.of( * v -> Vec.of(v[0]*cos(v[1]), v[0]*sin(v[1])), * Codecs.ofVector( @@ -59,7 +59,7 @@ * final ISeq >> result = engine.stream() * .limit(Limits.byFixedGeneration(50)) * .collect(MOEA.toParetoSet()); - * }
{@code + * {@snippet lang="java": * new NSGA2Selector<>( * Vec+ * } * * @see #ofVec() * @@ -140,14 +140,14 @@ private static int[] init(final int[] indexes) { /** * Return a new selector for the given result type {@code V}. This method is * a shortcut for - *::dominance, * Vec ::compare, * Vec ::distance, * Vec ::length * ); - * }
{@code + * {@snippet lang="java": * new NSGA2Selector<>( * Vec+ * } * * @param::dominance, * Vec ::compare, * Vec ::distance, * Vec ::length * ); - * }
* You can create a new {@code ParetoFront} for {@link Vec} objects - *
{@code + * {@snippet lang="java": * final ParetoFront+ * } * * or directly for {@code double[]} array objects - *> front = new ParetoFront<>(Vec::dominance); * front.add(Vec.of(1.0, 2.0)); * front.add(Vec.of(1.1, 2.5)); * front.add(Vec.of(0.9, 2.1)); * front.add(Vec.of(0.0, 2.9)); - * }
{@code + * {@snippet lang="java": * final ParetoFront+ * } * * You only have to specify the * Pareto dominance/efficiency measure. @@ -184,10 +184,10 @@ public ParetoFrontfront = new ParetoFront<>(Pareto::dominance); * front.add(new double[]{1.0, 2.0}); * front.add(new double[]{1.1, 2.5}); * front.add(new double[]{0.9, 2.1}); * front.add(new double[]{0.0, 2.9}); - * }
{@code + * {@snippet lang="java": * final ParetoFront+ * } * The example above reduces the given front to 10 elements. * * @param size the number of front elements after the trim. If diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/moea/UFTournamentSelector.java b/jenetics.ext/src/main/java/io/jenetics/ext/moea/UFTournamentSelector.java index 8ddd53b03f..a750963b48 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/moea/UFTournamentSelector.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/moea/UFTournamentSelector.java @@ -74,14 +74,14 @@ public class UFTournamentSelector< * Creates a new {@code UFTournamentSelector} with the functions needed for * handling the multi-objective result type {@code C}. For the {@link Vec} * classes, a selector is created like in the following example: - *> front = new ParetoFront<>(Vec::dominance); * front.trim(10, Vec::compare, Vec::distance, Vec::length); - * }
{@code + * {@snippet lang="java": * new UFTournamentSelector<>( * Vec+ * } * * @see #ofVec() * @@ -155,14 +155,14 @@ public ISeq::dominance, * Vec ::compare, * Vec ::distance, * Vec ::length * ); - * }
{@code + * {@snippet lang="java": * new UFTournamentSelector<>( * Vec+ * } * * @param::dominance, * Vec ::compare, * Vec ::distance, * Vec ::length * ); - * }
{@code + * {@snippet lang="java": * final Vec+ * } * * The underlying array is just wrapped and not copied. This * means you can change the values of the {@code Vec} once it is created, diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/moea/VecFactory.java b/jenetics.ext/src/main/java/io/jenetics/ext/moea/VecFactory.java index b3151c39f7..0d43b5dc16 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/moea/VecFactory.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/moea/VecFactory.java @@ -31,7 +31,7 @@ *point2D = Vec.of(0.1, 5.4); * final Vec point3D = Vec.of(1, 2, 3); - * }
* As the following example shows, only one {@code VecFactory} instance should * be used for creating the vectors for a given multi-objective problem. - *
{@code + * {@snippet lang="java": * private static final VecFactory+ * } * In the example above, the first dimension of the created vector is maximized, * the following two are minimized, and the last vector component is again * maximized. diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TRS.java b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TRS.java index bbfe3e34e6..1527d47d3e 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TRS.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TRS.java @@ -41,7 +41,7 @@ /** * This class represents a Tree Rewrite System, which consists of a set of * Tree Rewrite Rules. - *FACTORY = VecFactory.ofDoubleVec( * Optimize.MAXIMUM, * Optimize.MINIMUM, @@ -45,7 +45,7 @@ * // ... * return FACTORY.newVec(result); * } - * }
{@code + * {@snippet lang="java": * final TRS+ * } * * @see TreeRewriteRule * @see TRS diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatchResult.java b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatchResult.java index 7d725bfa35..2b74dd8142 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatchResult.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatchResult.java @@ -31,12 +31,12 @@ * The result of a tree match operation. It contains the matching tree and the * tree variables which matches the matching tree. * - *trs = TRS.parse( * "add(0,$x) -> $x", * "add(S($x),$y) -> S(add($x,$y))", @@ -53,7 +53,7 @@ * final TreeNode tree = TreeNode.parse("add(S(0),S(mul(S(0),S(S(0)))))"); * trs.rewrite(tree); * assert tree.equals(TreeNode.parse("S(S(S(S(0))))")); - * }
{@code + * {@snippet lang="java": * final Tree+ * } * * @see TreePattern#match(Tree) * @@ -62,12 +62,12 @@ private TreeMatchResult( * argument of the {@link TreePattern#match(Tree)} call, in the case of a * match. * - *tree = ...; * final TreePattern pattern = ...; * final Optional > result = pattern.match(tree); * result.ifPresent(r -> {assert r.tree() == tree;}); - * }
{@code + * {@snippet lang="java": * final Tree+ * } * * @return node (tree), which has been matched by some pattern */ diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatcher.java b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatcher.java index 2704ad271b..6d6e356fe8 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatcher.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreeMatcher.java @@ -29,7 +29,7 @@ * Implementation of a pattern-based tree matcher. It allows you to iterate over * all matches of a tree for a given pattern. * - *tree = ...; * final TreePattern pattern = ...; * final Optional > result = pattern.match(tree); * result.ifPresent(r -> {assert r.tree() == tree;}); - * }
{@code + * {@snippet lang="java": * final TreePattern+ * } * * @see TreePattern#matcher(Tree) * diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreePattern.java b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreePattern.java index 35ebeb30db..ad422d4583 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreePattern.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/rewriting/TreePattern.java @@ -62,16 +62,16 @@ * The string representation of a tree pattern is a parenthesis tree string, * with a special wildcard syntax for arbitrary subtrees. The subtree * variables are prefixed with a '$' and must be a valid Java identifier. - *pattern = TreePattern.compile("add($x,$y)"); * final Tree tree = TreeNode.parse("add(1,add(2,3))"); * final TreeMatcher matcher = pattern.matcher(tree); @@ -37,7 +37,7 @@ * // Prints: * // add(1,add(2,3)) * // add(2,3) - * }
{@code + * {@snippet lang="java": * final TreePattern+ * } * * If you need to have values which start with a '$' character, you can escape * it with a '\'. - *p1 = TreePattern.compile("add($a,add($b,sin(x)))"); * final TreePattern p2 = TreePattern.compile("pow($x,$y)"); - * }
{@code + * {@snippet lang="java": * final TreePattern+ * } * * The second value, {@code $foo}, of the {@code concat} function is not treated * as pattern variable. @@ -79,18 +79,18 @@ * If you want to match against trees with a different value type than * {@code String}, you have to specify an additional type mapper function when * compiling the pattern string. - *p1 = TreePattern.compile("concat($x,\\$foo)"); - * }
{@code + * {@snippet lang="java": * final TreePattern+ * } * *> p = TreePattern.compile( * "add($a,add($b,sin(x)))", * MathOp::toMathOp * ); - * }
Expanding trees
* * The second functionality of the tree pattern is to expand a pattern to a whole * tree with a given pattern variable to subtree mapping. - *{@code + * {@snippet lang="java": * final TreePattern+ * } * * @see TreeRewriteRule * @see Tree#toParenthesesString() diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTree.java b/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTree.java index f00350fa18..379483cc2f 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTree.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTree.java @@ -69,10 +69,10 @@ public interface FlatTreepattern = TreePattern.compile("add($x,$y,1)"); * final Map, Tree > vars = Map.of( * Var.of("x"), TreeNode.parse("sin(x)"), @@ -99,7 +99,7 @@ * * final Tree tree = pattern.expand(vars); * assertEquals(tree.toParenthesesString(), "add(sin(x),sin(y),1)"); - * }
{@code + * {@snippet lang="java": * final ISeq+ * } * * @return the flattened tree values in breadth-first order */ diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTreeNode.java b/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTreeNode.java index 255df177bb..b750890c83 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTreeNode.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/util/FlatTreeNode.java @@ -48,9 +48,9 @@ * flattened and dense layout it is also an immutable implementation of * the {@link Tree} interface. It can only be created from an existing tree. * - *seq = getRoot().breadthFirstStream() * .collect(ISeq.toISeq()); - * }
{@code + * {@snippet lang="java": * final Tree+ * } * * @implNote * This class is immutable and thread-safe. @@ -186,11 +186,11 @@ public Streamimmutable = FlatTreeNode.ofTree(TreeNode.parse(...)); - * }
{@code + * {@snippet lang="java": * final ISeq seq = stream() * .map(mapper) * .collect(ISeq.toISeq()) - * }+ * } * * @param mapper the mapper function * @param the mapped type @@ -353,12 +353,12 @@ public static FlatTreeNode
{@code + * {@snippet lang="java": * final Tree+ * } * * @see Tree#toParenthesesString(Function) * @see Tree#toParenthesesString() diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/util/Tree.java b/jenetics.ext/src/main/java/io/jenetics/ext/util/Tree.java index 97891d0e39..fefc0137bf 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/util/Tree.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/util/Tree.java @@ -211,10 +211,10 @@ default int size() { * {@code null} and has no children and parent. A newly created tree node * with no value is empty. * - *tree = FlatTreeNode.parse( * "0(1(4,5),2(6),3(7(10,11),8,9))", * Integer::parseInt * ); - * }
{@code + * {@snippet lang="java": * final Tree+ * } * * @since 7.0 * @@ -398,13 +398,13 @@ default ISeqtree = TreeNode.of(); * assert tree.isEmpty(); - * }
{@code + * {@snippet lang="java": * final Tree+ * } * * @since 5.1 * @@ -921,12 +921,12 @@ default Iteratortree = ...; * final Tree.Path path = tree.path(); * assert tree == tree.getRoot() * .childAtPath(path) * .orElse(null); - * }
{@code + * {@snippet lang="java": * final Tree, ?> node = ...; * final Tree, ?> root = node.getRoot(); * final int[] path = node.childPath(); * assert node == root.childAtPath(path); - * }+ * } * * @since 4.4 * @@ -972,7 +972,7 @@ default boolean identical(final Tree, ?> other) { * Performs a reduction on the elements of {@code this} tree, using an * associative reduction function. This can be used for evaluating a given * expression tree in pre-order. - *
{@code + * {@snippet lang="java": * final Tree+ * } * * @since 7.1 * diff --git a/jenetics.ext/src/main/java/io/jenetics/ext/util/TreeNode.java b/jenetics.ext/src/main/java/io/jenetics/ext/util/TreeNode.java index e2f016dc20..46560e4c1f 100644 --- a/jenetics.ext/src/main/java/io/jenetics/ext/util/TreeNode.java +++ b/jenetics.ext/src/main/java/io/jenetics/ext/util/TreeNode.java @@ -532,12 +532,12 @@ public staticformula = TreeNode.parse("add(sub(6,div(230,10)),mul(5,6))"); * final double result = formula.reduce(new Double[0], (op, args) -> * switch (op) { @@ -984,7 +984,7 @@ default boolean identical(final Tree, ?> other) { * } * ); * assert result == 13.0; - * }
{@code + * {@snippet lang="java": * final TreeNode+ * } * The code above will trim all tree nodes during the parsing process. * * @see Tree#toParenthesesString(Function) @@ -564,12 +564,12 @@ public static TreeNodetree = TreeNode.parse( * "mul( div(cos( 1.0) , cos(π )), sin(mul(1.0, z) ) )", * String::trim * ); - * }
{@code + * {@snippet lang="java": * final Tree+ * } * * @see Tree#toParenthesesString(Function) * @see Tree#toParenthesesString() diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/BreathFirstIterator.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/BreathFirstIterator.java index f54721ebf1..c7802d85d6 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/BreathFirstIterator.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/BreathFirstIterator.java @@ -39,7 +39,7 @@ * It also tracks already visited nodes to prevent infinite loops in the traversal. * The following code example shows how to recursively travers the properties of * a simple domain model: - *tree = TreeNode.parse( * "0(1(4,5),2(6),3(7(10,11),8,9))", * Integer::parseInt * ); - * }
{@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * @paramauthors) { } * @@ -57,7 +57,7 @@ * ); * * it.forEachRemaining(System.out::println); - * }
{@code + * {@snippet lang="java": * final Predicate super Path> filter = Stream.of(includes) * .map(include -> Filters * .filtering( @@ -36,7 +36,7 @@ * Filters.ofGlob(include) * ) * ) - * }+ * } * * @author Franz Wilhelmstötter * @version 7.2 diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/Path.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/Path.java index b4e9e22cb5..ae1437d8e1 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/Path.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/Path.java @@ -349,9 +349,9 @@ public static Path of(final Element... elements) { * valid path consists of a names, which must be a valid Java identifier, * and indexes, separated by a dot, '.'. A valid path with three elements * will look like this: - *
{@code + * {@snippet lang="java": * final var path = Path.of("name1.name2[9].value"); - * }+ * } * * @param value the path value * @return a new property path diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/PostOrderIterator.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/PostOrderIterator.java index c277051637..745a256217 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/PostOrderIterator.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/PostOrderIterator.java @@ -36,7 +36,7 @@ * also tracks already visited nodes to prevent infinite loops in the traversal. * The following code example shows how to recursively travers the properties of * a simple domain model: - *
{@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * @paramauthors) { } * @@ -54,7 +54,7 @@ * ); * * it.forEachRemaining(System.out::println); - * }
{@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * @paramauthors) { } * @@ -58,7 +58,7 @@ * ); * * it.forEachRemaining(System.out::println); - * }
{@code + * {@snippet lang="java": * final Type type = ...; * if (ArrayType.of(type) instanceof ArrayType at) { * System.out.println(at); * } - * }+ * } */ public sealed interface Trait { } @@ -194,12 +194,12 @@ public void set(Object object, int index, Object value) { /** * Return a {@code OptionalType} instance if the given {@code type} is a * {@code Optional} class. - *
{@code + * {@snippet lang="java": * final Type type = ...; * if (OptionalType.of(type) instanceof OptionalType ot) { * System.out.println(ot); * } - * }+ * } * * @param type the type object * @return an {@code OptionalType} if the given {@code type} is an @@ -262,12 +262,12 @@ public void set(Object object, int index, Object value) { /** * Return an {@code ArrayType} instance if the given {@code type} is an * array class. - *
{@code + * {@snippet lang="java": * final Type type = ...; * if (ArrayType.of(type) instanceof ArrayType at) { * System.out.println(at); * } - * }+ * } * * @param type the type object * @return an {@code ArrayType} if the given {@code type} is an array @@ -328,12 +328,12 @@ public void set(Object object, int index, Object value) { /** * Return a {@code ListType} instance if the given {@code type} is a * {@code List} class. - *
{@code + * {@snippet lang="java": * final Type type = ...; * if (ListType.of(type) instanceof ListType lt) { * System.out.println(lt); * } - * }+ * } * * @param type the type object * @return an {@code ListType} if the given {@code type} is a list type, @@ -451,12 +451,12 @@ public Stream
{@code + * {@snippet lang="java": * final Type type = ...; * if (RecordType.of(type) instanceof RecordType rt) { * System.out.println(rt); * } - * }+ * } * * @param type the type object * @return an {@code RecordType} if the given {@code type} is a record @@ -506,12 +506,12 @@ public Stream
{@code + * {@snippet lang="java": * final Type type = ...; * if (BeanType.of(type) instanceof BeanType bt) { * System.out.println(bt); * } - * }+ * } * * @param type the type object * @return an {@code ListType} if the given {@code type} is a bean type, diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/Descriptions.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/Descriptions.java index 3da9bf4caf..ef5c14bf64 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/Descriptions.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/Descriptions.java @@ -107,11 +107,11 @@ public static Stream
{@code + * {@snippet lang="java": * Descriptions * .walk(PathEntry.of(String.class), Descriptions::extract) * .forEach(System.out::println); - * }+ * } * * The code snippet above will create the following output: * @@ -152,24 +152,24 @@ public static Stream
{@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * The code snippet above will create the following output: * - *authors) { } * * Descriptions.walk(PathEntry.of(Book.class)) * .forEach(System.out::println); - * }
{@code + * {@snippet lang="java": * Description[path=authors, value=Single[value=java.util.List+ * } * * @see #walk(PathValue, Dtor) * @see #walk(Type) diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/package-info.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/package-info.java index e6a25fb5c4..652bd18c81 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/package-info.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/description/package-info.java @@ -23,23 +23,23 @@ * The main entry point of this package is the * {@link io.jenetics.incubator.beans.description.Descriptions} object. * - *, enclosure=Book]] * Description[path=authors[0], value=Indexed[value=Author, enclosure=java.util.List]] * Description[path=authors[0].forename, value=Single[value=java.lang.String, enclosure=Author]] * Description[path=authors[0].surname, value=Single[value=java.lang.String, enclosure=Author]] * Description[path=pages, value=Single[value=int, enclosure=Book]] * Description[path=title, value=Single[value=java.lang.String, enclosure=Book]] - * }
{@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * The code snippet above will create the following output: * - *authors) { } * * Descriptions.walk(PathEntry.of(Book.class)) * .forEach(System.out::println); - * }
{@code + * {@snippet lang="java": * Description[path=authors, value=Single[value=java.util.List+ * } */ package io.jenetics.incubator.beans.description; diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Properties.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Properties.java index 782d822316..75face0a10 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Properties.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Properties.java @@ -185,11 +185,11 @@ private static Property.Value toValue( * starting {@code root} object. If used with the {@link #unapply(PathValue)} * method, all found descriptions are returned, including the descriptions * from the Java classes. - *, enclosure=Book]] * Description[path=authors[0], value=Indexed[value=Author, enclosure=java.util.List]] * Description[path=authors[0].forename, value=Single[value=java.lang.String, enclosure=Author]] * Description[path=authors[0].surname, value=Single[value=java.lang.String, enclosure=Author]] * Description[path=pages, value=Single[value=int, enclosure=Book]] * Description[path=title, value=Single[value=java.lang.String, enclosure=Book]] - * }
{@code + * {@snippet lang="java": * final var object = "Some Value"; * Properties.walk(PathEntry.of(object), Properties::extract) * .forEach(System.out::println); - * }+ * } * The code snippet above will create the following output: *
* SimpleProperty[path=blank, value=Mutable[value=false, type=boolean, enclosureType=java.lang.String]] @@ -226,7 +226,7 @@ public static Stream*/ public static final class DoubleChromosome { private DoubleChromosome() {} diff --git a/jenetics.xml/src/main/java/io/jenetics/xml/Writers.java b/jenetics.xml/src/main/java/io/jenetics/xml/Writers.java index 1c0423d23b..097d630d45 100644 --- a/jenetics.xml/src/main/java/io/jenetics/xml/Writers.java +++ b/jenetics.xml/src/main/java/io/jenetics/xml/Writers.java @@ -47,7 +47,7 @@ * This class contains static fields and methods, for creating chromosome- and * genotype writers for different gene types. * - *walk( * Return a {@code Stream} that is lazily populated with {@code Property} * by walking the object tree rooted at a given starting object. * - * {@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * The code snippet above will create the following output: * - *authors) { } * @@ -238,18 +238,18 @@ public static Stream walk( * * Properties.walk(PathEntry.of(object)) * .forEach(System.out::println); - * } {@code + * {@snippet lang="java": * ListProperty[path=authors, value=Immutable[value=[Author[forename=Charles, surname=Dickens]], type=java.util.List, enclosureType=Book]] * IndexProperty[path=authors[0], value=Mutable[value=Author[forename=Charles, surname=Dickens], type=Author, enclosureType=java.util.ImmutableCollections$List12]] * SimpleProperty[path=authors[0].forename, value=Immutable[value=Charles, type=java.lang.String, enclosureType=Author]] * SimpleProperty[path=authors[0].surname, value=Immutable[value=Dickens, type=java.lang.String, enclosureType=Author]] * SimpleProperty[path=pages, value=Immutable[value=366, type=int, enclosureType=Book]] * SimpleProperty[path=title, value=Immutable[value=Oliver Twist, type=java.lang.String, enclosureType=Book]] - * }+ * } * * @see #walk(Object, String...) * diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Property.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Property.java index 56f19ae3a2..cb1aa5f94d 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Property.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/Property.java @@ -32,39 +32,39 @@ * bean property, with getter and setter, or as record component. The * following code shows how to create (a transitive) list of all properties from * a given root object. - *{@code + * {@snippet lang="java": * final var root = ...; * final List+ * } * Only get string properties. - *properties = Properties * // Get all properties from the 'root' object which are defined * // in the 'io.jenetics' package. * .stream(root, "io.jenetics") * .toList(); - * } {@code + * {@snippet lang="java": * final List+ * } * Only get the properties declared in the {@code MyBeanObject} class. - *properties = Properties * .stream(root, "io.jenetics") * .filter(property -> property.type() == String.class) * .toList(); - * } {@code + * {@snippet lang="java": * final List+ * } * Only get properties with the name {@code index}. No matter where they defined * in the object hierarchy. - *properties = Properties * .stream(root, "io.jenetics") * .filter(property -> property.object().getClass() == MyBeanObject.class) * .toList(); - * } {@code + * {@snippet lang="java": * final List+ * } * Updates all "index" properties with value {@code -1} to zero and returns all * properties, which couldn't be updated, because the property was immutable. - *properties = Properties * .stream(root, "io.jenetics") * .filter(Property.pathMatcher("**index")) * .toList(); - * } {@code + * {@snippet lang="java": * final List+ * } * * @author Franz Wilhelmstötter * @version 7.2 diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/package-info.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/package-info.java index d4cd5a4341..8220eb05a3 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/package-info.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/beans/property/package-info.java @@ -23,7 +23,7 @@ * The main entry point of this package is the * {@link io.jenetics.incubator.beans.property.Properties} object. * - *notUpdated = Properties * .stream(root, "io.jenetics") * .filter(Property.pathMatcher("**index")) @@ -72,7 +72,7 @@ * .filter(property -> !property.write(0)) * .toList(); * assert notUpdated.isEmpty(); - * } {@code + * {@snippet lang="java": * record Author(String forename, String surname) { } * record Book(String title, int pages, List+ * } * * The code snippet above will create the following output: * - *authors) { } * @@ -35,17 +35,17 @@ * * Properties.walk(PathEntry.of(object)) * .forEach(System.out::println); - * } {@code + * {@snippet lang="java": * ListProperty[path=authors, value=Immutable[value=[Author[forename=Charles, surname=Dickens]], type=java.util.List, enclosureType=Book]] * IndexProperty[path=authors[0], value=Mutable[value=Author[forename=Charles, surname=Dickens], type=Author, enclosureType=java.util.ImmutableCollections$List12]] * SimpleProperty[path=authors[0].forename, value=Immutable[value=Charles, type=java.lang.String, enclosureType=Author]] * SimpleProperty[path=authors[0].surname, value=Immutable[value=Dickens, type=java.lang.String, enclosureType=Author]] * SimpleProperty[path=pages, value=Immutable[value=366, type=int, enclosureType=Book]] * SimpleProperty[path=title, value=Immutable[value=Oliver Twist, type=java.lang.String, enclosureType=Book]] - * }+ * } */ package io.jenetics.incubator.beans.property; diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/util/CsvSupport.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/util/CsvSupport.java index 06310fd720..fdfdd56d99 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/util/CsvSupport.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/util/CsvSupport.java @@ -45,7 +45,7 @@ * Helper methods for splitting CSV rows and merging CSV columns into a valid * CSV row. * - *{@code + * {@snippet lang="java": * // Read CSV, including multiline CSV files, if properly quoted. * final List+ * } * * @see RFC-4180 * @@ -94,11 +94,11 @@ private CsvSupport() { * in RFC-4180. This is * the reverse of the {@link #join(Iterable)} method. * - *> rows; * try (Stream
lines = CsvSupport.read(new FileReader("some_file.csv"))) { @@ -57,7 +57,7 @@ * .map(CsvSupport::join) * .collect(CsvSupport.toCsv()); * Files.writeString(Path.of("some_other_file.csv"), csv); - * } {@code + * {@snippet lang="java": * final var line = "a,b,c,d,e,f"; * final var cols = CsvSupport.split(line); * assert List.of("a", "b", "c", "d", "e", "f").equals(cols) - * }+ * } * * @see RFC-4180 * @see #split(CharSequence, String[], int...) @@ -129,11 +129,11 @@ public static Listsplit(final CharSequence line, final int... indexes) * in RFC-4180. This is * the reverse of the {@link #join(Iterable)} method. * - * {@code + * {@snippet lang="java": * final var line = "a,b,c,d,e,f"; * final var cols = new String[6] * CsvSupport.split(line, cols); - * }+ * } * * @param line the CSV {@code row} to split * @param columns the columns, where the split result is written to. The @@ -163,11 +163,11 @@ static boolean isTokenSeparator(final char c) { * Joins the given columns to a CSV line. This is the reverse operation of * the {@link #split(CharSequence, int...)} method. * - *{@code + * {@snippet lang="java": * final var cols = List.of("a", "b", "c", "d", "e", "f"); * final var line = CsvSupport.join(cols); * assert "a,b,c,d,e,f".equals(line); - * }+ * } * * @see #split(CharSequence, int...) * @@ -217,13 +217,13 @@ private static boolean mustEscape(CharSequence value) { /** * Return a collector for joining a list of CSV rows into one CSV string. * - *{@code + * {@snippet lang="java": * final List+ * } * * @return a collector for joining a list of CSV rows into one CSV string */ diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/util/Serializer.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/util/Serializer.java index 76de74c622..28384c886f 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/util/Serializer.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/util/Serializer.java @@ -52,7 +52,7 @@ * The methods of this class allow appending additional objects to an existing * file. * - *> rows = ...; * * final String csv = rows.stream() * .map(CsvSupport::join) * .collect(CsvSupport.toCSV()); - * }
{@code + * {@snippet lang="java": * // Write three string objects to the given path and read them again. * Serializer.write(path, List.of("1", "2", "3")); * List+ * } * * It also allows reading object piecewise via a {@link Stream}. * - *{@code + * {@snippet lang="java": * try (Stream+ * } * * @author Franz Wilhelmstötter * @since 6.2 @@ -216,24 +216,24 @@ public void write(final byte[] b, final int off, final int len) * using Java serialization. For the first objects to be written * to the stream, the {@code append} flag must be set to {@code false}. * - *{@code + * {@snippet lang="java": * final var output = new ByteArrayOutputStream(); * Serializer.write(output, List.of("1", "2", "3"), false); * * var input = new ByteArrayInputStream(output.toByteArray()); * final List+ * } * * When writing additional objects to the same output stream, the * {@code append} must be set to {@code true}. * - *{@code + * {@snippet lang="java": * Serializer.write(output, List.of("4", "5"), true); * input = new ByteArrayInputStream(output.toByteArray()); * objects = Serializer.readAllObjects(input); * assert objects.equals(List.of("1", "2", "3", "4", "5")); - * }+ * } * * It is the responsibility of the caller to close the given {@code output} * stream when no longer needed. @@ -290,21 +290,21 @@ private static long write0( * {@code options} contains {@link StandardOpenOption#APPEND}, the objects * are appended to the existing file. * - *{@code + * {@snippet lang="java": * // Write three string objects to the given file. The file is created if * // it not exists or appended if the file already exists. * Serializer.write(path, List.of("1", "2", "3")); - * }+ * } * * Truncating an existing file: - *{@code + * {@snippet lang="java": * // Write three string objects to the given file. The file is truncated if * // it exists or created if the file doesn't exists. * Serializer.write( * path, List.of("1", "2", "3"), * StandardOpenOption.TRUNCATE_EXISTING * ); - * }+ * } * * @see #write(Iterable, OutputStream, boolean) * @@ -380,12 +380,12 @@ private static boolean isEmpty(final Path file) throws IOException { * objects efficiently. Note that the caller is responsible for closing the * returned object stream, which also closes the given {@code input} stream. * - *{@code + * {@snippet lang="java": * final InputStream input = ...; * try (Stream+ * } * * @see #objects(Path) * @@ -440,11 +440,11 @@ public synchronized Object get() { * read huge files efficiently. Note that the caller is responsible for * closing the returned object stream. * - *{@code + * {@snippet lang="java": * try (Stream+ * } * * @see #objects(InputStream) * diff --git a/jenetics.incubator/src/main/java/io/jenetics/incubator/util/TaskCompletion.java b/jenetics.incubator/src/main/java/io/jenetics/incubator/util/TaskCompletion.java index c599d7dfd3..8b49096ddd 100644 --- a/jenetics.incubator/src/main/java/io/jenetics/incubator/util/TaskCompletion.java +++ b/jenetics.incubator/src/main/java/io/jenetics/incubator/util/TaskCompletion.java @@ -43,7 +43,7 @@ * were submitted. The tasks are executed asynchronously, but not * concurrently. * - *{@code + * {@snippet lang="java": * final var executor = new TaskCompletion(ForkJoinPool.commonPool()); * final var results = new ArrayList+ * } * * Since the tasks are executed in the submitted order and the next task is * executed if the previous one has been finished, it is not necessary to use diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/ProgramChromosome.java b/jenetics.prog/src/main/java/io/jenetics/prog/ProgramChromosome.java index abf0f172f3..a7c6da8239 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/ProgramChromosome.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/ProgramChromosome.java @@ -48,7 +48,7 @@ /** * Holds the nodes of the operation tree. * - *(); * @@ -58,7 +58,7 @@ * for (int i = 0; i < results.size(); ++i) { * assert results.get(i) == i; * } - * } {@code + * {@snippet lang="java": * final int depth = 6; * final ISeq+ * } * * @author Franz Wilhelmstötter * @version 4.1 @@ -357,7 +357,7 @@ public static ProgramChromosome of( * operation tree. If the tree is not valid, it will repair it. This * behaviour allows the safe usage of all existing alterers. * - *> operations = ISeq.of(...); * final ISeq > terminals = ISeq.of(...); @@ -59,7 +59,7 @@ * operations, * terminals * ); - * } {@code + * {@snippet lang="java": * final ProgramChromosome+ * } * * @param genes the program genes * @param validator the chromosome validator to use diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/ProgramGene.java b/jenetics.prog/src/main/java/io/jenetics/prog/ProgramGene.java index 29ef1c4cb9..4d576ff8d3 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/ProgramGene.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/ProgramGene.java @@ -42,14 +42,14 @@ * error space. Since the {@code ProgramGene} also is a {@code Tree}, * it can be easily used as a result. * - *ch = ProgramChromosome.of( * genes, * // If the program has more that 200 nodes, it is marked as "invalid". @@ -365,7 +365,7 @@ public static ProgramChromosome of( * operations, * terminals * ); - * } {@code + * {@snippet lang="java": * final ProgramGene+ * } * * @author Franz Wilhelmstötter * @version 5.2 diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/BoolOp.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/BoolOp.java index 578d20795f..41d919e00d 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/BoolOp.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/BoolOp.java @@ -136,7 +136,7 @@ public String toString() { * an operation tree. If you use it that way, you should not forget to * re-index the tree variables. * - *program = engine.stream() * .limit(300) * .collect(EvolutionResult.toBestGenotype()) * .getGene(); * * final double result = program.eval(3.4); - * } {@code + * {@snippet lang="java": * final TreeNode+ * } * * @since 5.0 * diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/Const.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/Const.java index 8048d4a91c..6d0e0a3cba 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/Const.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/Const.java @@ -38,10 +38,10 @@ * is used when printing the program tree. The {@code Const} operation is a * terminal operation. * - *> tree = TreeNode.parse( * "and(or(x,y),not(y))", * BoolOp::toBoolOp @@ -145,7 +145,7 @@ public String toString() { * assert Program.eval(tree, false, false) == false; * Var.reindex(tree); * assert Program.eval(tree, false, false) == true; - * } {@code + * {@snippet lang="java": * final static Op+ * } * * @author Franz Wilhelmstötter * @version 7.0 diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/ConstRewriter.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/ConstRewriter.java index c553cb97e5..67ea8c8448 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/ConstRewriter.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/ConstRewriter.java @@ -35,11 +35,11 @@ *PI = Const.of("π", Math.PI); * final static Op ONE = Const.of(1.0); - * } * The following example shows how to use the rewriter for a double operation * tree: - *
{@code + * {@snippet lang="java": * final TreeNode+ * } * * @param> tree = MathExpr.parseTree("1 + 2 + 3 + 4"); * ConstRewriter.ofType(Double.class).rewrite(tree); * assert tree.getValue().equals(Const.of(10.0)); - * } the operation type the rewriter is working on * diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/EphemeralConst.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/EphemeralConst.java index 095c75e754..fc24a57f23 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/EphemeralConst.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/EphemeralConst.java @@ -43,27 +43,27 @@ * particular terminal, and which will remain fixed for the given tree. The main * usage would be to introduce random terminal values. * - * {@code + * {@snippet lang="java": * final Random random = ...; * final Op+ * } * * Serialization * Although the {@code EphemeralConst} class implements the {@link Serializable} * interface, the serialization will fail if the const supplier is not * serializable as well. This can be achieved by casting the * supplier to a {@link Serializable}. - *val = EphemeralConst.of(random::nextDouble); - * } {@code + * {@snippet lang="java": * final Random random = new Random(); * final EphemeralConst+ * } * The serialization of the constant will fail, if the lambda has to * capture variables form a non-serializable context (class). In such a * case, it is advisable to create a dedicated supplier class. - *object = EphemeralConst.of( * "R", * (Supplier & Serializable)random::nextInt * ); - * } {@code + * {@snippet lang="java": * final class RandomInt implements Supplier+ * } * * * @author Franz Wilhelmstötter diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/MathExpr.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/MathExpr.java index b1c9869e9c..38381ef72b 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/MathExpr.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/MathExpr.java @@ -95,11 +95,11 @@ public final class MathExpr /** * This tree-rewriter rewrites constant expressions to its single value. * - *, Serializable { * private final Random rnd = new Random(); * private final int min; @@ -79,7 +79,7 @@ * return rnd.nextInt(max - min) + min; * } * } - * } {@code + * {@snippet lang="java": * final TreeNode+ * } * * @since 5.0 */ @@ -238,10 +238,10 @@ public Double apply(final Double[] args) { * Convenient method, which lets you apply the program function without * explicitly create a wrapper array. * - *> tree = MathExpr.parseTree("1 + 2*(6 + 7)"); * MathExpr.CONST_REWRITER.rewrite(tree); * assertEquals(tree.getValue(), Const.of(27.0)); - * } {@code + * {@snippet lang="java": * final double result = MathExpr.parse("2*z + 3*x - y").eval(3, 2, 1); * assert result == 9.0; - * }+ * } * * @see #apply(Double[]) * @see #eval(String, double...) @@ -273,11 +273,11 @@ public boolean equals(final Object obj) { * Return the string representation of this {@code MathExpr} object. The * string returned by this method can be parsed again and will result in the * same expression object. - *{@code + * {@snippet lang="java": * final String expr = "5.0 + 6.0*x + sin(x)^34.0 + (1.0 + sin(x*5.0)/4.0) + 6.5"; * final MathExpr tree = MathExpr.parse(expr); * assert tree.toString().equals(expr); - * }+ * } * * @return the expression string */ @@ -398,11 +398,11 @@ static MathExpr read(final DataInput in) throws IOException { * Return the string representation of the given {@code tree} object. The * string returned by this method can be parsed again and will result in the * same expression object. - *{@code + * {@snippet lang="java": * final String expr = "5.0 + 6.0*x + sin(x)^34.0 + (1.0 + sin(x*5.0)/4.0) + 6.5"; * final MathExpr tree = MathExpr.parse(expr); * assert MathExpr.format(tree.tree()).equals(expr); - * }+ * } * * @since 4.3 * @@ -431,10 +431,10 @@ public static MathExpr parse(final String expression) { * Parses the given mathematical expression string and returns the * mathematical expression tree. The expression may contain all functions * defined in {@link MathOp}. - *{@code + * {@snippet lang="java": * final Tree extends Op+ * } * The example above will lead to the following tree: *, ?> tree = MathExpr * .parseTree("5 + 6*x + sin(x)^34 + (1 + sin(x*5)/4)/6"); - * } {@code * add @@ -481,10 +481,10 @@ public static MathExpr parse(final String expression) { /** * Evaluates the given {@code expression} with the given arguments. * - *+ * }{@code + * {@snippet lang="java": * final double result = MathExpr.eval("2*z + 3*x - y", 3, 2, 1); * assert result == 9.0; - * }+ * } * * @see #apply(Double[]) * @see #eval(double...) diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/MathOp.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/MathOp.java index c61d0b90c8..9b2985b4be 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/MathOp.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/MathOp.java @@ -415,7 +415,7 @@ public String toString() { * an operation tree. If you use it that way, you should not forget to * re-index the tree variables. * - *{@code + * {@snippet lang="java": * final TreeNode+ * } * * @since 5.0 * diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/MathStringTokenizer.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/MathStringTokenizer.java index a7d684c3a0..8173256e6c 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/MathStringTokenizer.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/MathStringTokenizer.java @@ -42,7 +42,7 @@ /** * Tokenizer for simple arithmetic expressions. * - *> tree = TreeNode.parse( * "add(mul(x,y),sub(y,x))", * MathOp::toMathOp @@ -424,7 +424,7 @@ public String toString() { * assert Program.eval(tree, 10.0, 5.0) == 100.0; * Var.reindex(tree); * assert Program.eval(tree, 10.0, 5.0) == 45.0; - * } {@code + * {@snippet lang="java": * LPAREN: '('; * RPAREN: ')'; * COMMA: ','; @@ -54,7 +54,7 @@ * NUMBER: ('0'..'9')+ ('.' ('0'..'9')+)? ((e|E) (+|-)? ('0'..'9'))? * ID: ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')+; * WS: [ \r\n\t] + -> skip; - * }+ * } * * @author Franz Wilhelmstötter * @since 7.1 diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/Op.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/Op.java index c1044639a6..51351e9c6e 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/Op.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/Op.java @@ -31,12 +31,12 @@ * with a given arity to a result object of the same type: * {@code T[] -> T}. * - *{@code + * {@snippet lang="java": * final Op+ * } * * Implementations of the {@code Op} interface are usually immutable and doesn't * maintain internal state. But some instances are ephemeral with changing state. diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/Program.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/Program.java index 01a75f6804..e848f7f0be 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/Program.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/Program.java @@ -149,9 +149,9 @@ public String toString() { /** * Evaluates the given operation tree with the given variables. This method * is equivalent to - *add = Op.of("add", 2, v -> v[0] + v[1]); * final Op add3 = Op.of("add3", 3, v -> v[0] + v[1] + v[2]); * final Op sub = Op.of("sub", 2, v -> v[0] - v[1]); * final Op sin = Op.of("sin", 1, v -> Math.sin(v[0])); - * } {@code + * {@snippet lang="java": * final T result = tree.reduce(variables, Op::apply); - * }+ * } * but handles the variable sized {@code variables} array more conveniently. * * @see Tree#reduce(Object[], BiFunction) diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/Var.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/Var.java index cf12f23d0f..6c27b80081 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/Var.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/Var.java @@ -43,17 +43,17 @@ * of the n-dimensional input space to the 1-dimensional * result space. * - *{@code + * {@snippet lang="java": * final ISeq extends Op+ * } * * The example above shows how to define the terminal operations for a GP, which * tries to optimize a 2-dimensional function. * - *> operations = ISeq.of(...); * final ISeq extends Op > terminals = ISeq.of( * Var.of("x", 0), Var.of("y", 1) * ); - * } {@code + * {@snippet lang="java": * static double error(final ProgramChromosome+ * } * * @implNote * The {@code Var} object is comparable, according its name. @@ -247,7 +247,7 @@ public staticprogram) { * final double x = ...; * final double y = ...; @@ -61,7 +61,7 @@ * ... * return ...; * } - * } Var parse(final String name) { * the variables. The indices of the variables are assigned according it's * natural order. * - * {@code + * {@snippet lang="java": * final TreeNode+ * } * The example above shows a use-case of this method. If you parse a tree * string and convert it to an operation tree, you have to re-index the * variables first. If not, you will get the wrong result when evaluating @@ -291,7 +291,7 @@ public static> tree = TreeNode.parse( * "add(mul(x,y),sub(y,x))", * MathOp::toMathOp @@ -256,7 +256,7 @@ public static Var parse(final String name) { * assert Program.eval(tree, 10.0, 5.0) == 100.0; // wrong result * Var.reindex(tree); * assert Program.eval(tree, 10.0, 5.0) == 45.0; // correct result - * } void reindex(final TreeNode > tree) { * of the variables ({@link Var}), are all set to zero, since it needs the * whole tree for setting the indices correctly. * - * {@code + * {@snippet lang="java": * final TreeNode+ * } * The example above shows a use-case of this method. If you parse a tree * string and convert it to an operation tree, you have to re-index the * variables first. If not, you will get the wrong result when evaluating diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/op/package-info.java b/jenetics.prog/src/main/java/io/jenetics/prog/op/package-info.java index 9c6857d20c..8609f792c3 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/op/package-info.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/op/package-info.java @@ -25,17 +25,17 @@ * instance of the {@code ProgramGene} or {@code ProgramChromosome} class. The * extension point for own programs is the {@code Op} interface. * - *> tree = TreeNode.parse( * "add(mul(x,y),sub(y,x))", * MathOp::toMathOp @@ -303,7 +303,7 @@ public static void reindex(final TreeNode > tree) { * indexes.put(Var.of("y"), 1); * Var.reindex(tree, indexes); * assert Program.eval(tree, 10.0, 5.0) == 45.0; // correct result - * } {@code + * {@snippet lang="java": * public interface Op+ * } * - *{ * public String name(); * public int arity(); * public T apply(T[] args); * } - * } {@code + * {@snippet lang="java": * final Op+ * } * * In the example above, a new operation with the "myop" and arity 3 is defined. * Whenever the operation is evaluated, the function f(x, y, z) = x*y + z @@ -64,11 +64,11 @@ * The {@code Var} operation defines a variable of a program, which are set * from the program arguments. * - *myop = Op.of("myop", 3, v -> v[0]*v[1] + v[2]); - * } {@code + * {@snippet lang="java": * final ISeq+ * } * * The terminal operation list in the example code above will lead to a program * which takes three input parameters, x, y and z, @@ -79,10 +79,10 @@ * The {@code Const} operation will always return the same, constant, value * when evaluated. * - *> terminals = ISeq.of( * Var.of("x", 0), Var.of("y", 1), Var.of("z", 2) * ); - * } {@code + * {@snippet lang="java": * final Op+ * } * * We can create a constant operation in to flavors, with a value only and with * a dedicated name. If a constant has a name, the symbolic name is @@ -95,10 +95,10 @@ * {@link java.util.function.Supplier} function the ephemeral constant is created * with. * - *one = Const.of(1.0); * final Op pi = Const.of("π", Math.PI); - * } {@code + * {@snippet lang="java": * final Op+ * } * * * @author Franz Wilhelmstötter diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/package-info.java b/jenetics.prog/src/main/java/io/jenetics/prog/package-info.java index 0703b42372..4f5ed898b8 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/package-info.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/package-info.java @@ -54,7 +54,7 @@ * polynomial example we will chose the following operations * and terminals. * - *rand1 = EphemeralConst.of(Math::random); * final Op rand2 = EphemeralConst.of("R", Math::random); - * } {@code + * {@snippet lang="java": * static final ISeq+ * } * * The chosen non-terminal operation set is sufficient to create any polynomial. * For the terminal operations, we added a variable "x", with index zero, and @@ -76,7 +76,7 @@ * In the next step define the fitness function for the GP, which will be an * error function we will minimize. * - *> OPERATIONS = ISeq.of( * MathOp.ADD, * MathOp.SUB, @@ -65,7 +65,7 @@ * Var.of("x", 0), * EphemeralConst.of(() -> (double)RandomRegistry.getRandom().nextInt(10)) * ); - * } {@code + * {@snippet lang="java": * // The lookup table where the data points are stored. * static final double[][] SAMPLES = new double[][] { * {-1.0, -8.0000}, @@ -93,7 +93,7 @@ * }) * .sum(); * } - * }+ * } * * The error function calculates the sum of the (absolute) difference between * the sample value and the value calculated the by the evolved program @@ -110,7 +110,7 @@ * After we have defined the error function, we need to define the proper * {@code Codec}. * - *{@code + * {@snippet lang="java": * static final Codec+ * } * * * There are two particularities in the definition of the @@ -140,7 +140,7 @@ * * Now we are ready to put everything together: * - *, ProgramGene > CODEC = * Codec.of( * Genotype.of(ProgramChromosome.of( @@ -123,7 +123,7 @@ * )), * Genotype::gene * ); - * } {@code + * {@snippet lang="java": * public static void main(final String[] args) { * final Engine+ * } * * The GP is capable of finding the polynomial which created the sample data. * After a few tries, we got the following (correct) output program: diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/regression/Complexity.java b/jenetics.prog/src/main/java/io/jenetics/prog/regression/Complexity.java index 14c6c58564..d2d26c110c 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/regression/Complexity.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/regression/Complexity.java @@ -32,9 +32,9 @@ * values are preferred. It is part of the overall {@link Error} * function. * - *, Double> engine = Engine * .builder(Polynomial::error, CODEC) @@ -157,7 +157,7 @@ * * System.out.println(Tree.toString(program)); * } - * } {@code + * {@snippet lang="java": * final Error+ * } * * @see LossFunction * @see Error @@ -87,10 +87,10 @@ staticerror = Error.of(LossFunction::mse, Complexity.ofNodeCount(50)); - * } Complexity ofNodeCount(final int maxNodeCount) { * If the node count is bigger or equal {@code maxNodes}, one is returned. * * The complexity is calculated in the following way: - *
{@code + * {@snippet lang="java": * final double cc = min(program.size() - 1, maxNodes); * return 1.0 - sqrt(1.0 - (cc*cc)/(maxNodes*maxNodes)); - * }+ * } * * @see #ofNodeCount(int) * diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/regression/Error.java b/jenetics.prog/src/main/java/io/jenetics/prog/regression/Error.java index 20267245d9..b98a4abfaf 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/regression/Error.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/regression/Error.java @@ -32,9 +32,9 @@ * The error is calculated from the {@link LossFunction} and, if desired, the * program {@link Complexity}. * - *{@code + * {@snippet lang="java": * final Error+ * } * * @see LossFunction * @see Complexity diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/regression/LossFunction.java b/jenetics.prog/src/main/java/io/jenetics/prog/regression/LossFunction.java index 581d2137bf..db4fd54a77 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/regression/LossFunction.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/regression/LossFunction.java @@ -32,9 +32,9 @@ * output a higher value. If they're pretty good, it’ll output a lower number. * It is the essential part of the overall {@link Error} function. * - *error = Error.of(LossFunction::mse, Complexity.ofNodeCount(50)); - * } {@code + * {@snippet lang="java": * final Error+ * } * * @see Loss function * diff --git a/jenetics.prog/src/main/java/io/jenetics/prog/regression/Regression.java b/jenetics.prog/src/main/java/io/jenetics/prog/regression/Regression.java index 545b1aaefd..01fbcf30a4 100644 --- a/jenetics.prog/src/main/java/io/jenetics/prog/regression/Regression.java +++ b/jenetics.prog/src/main/java/io/jenetics/prog/regression/Regression.java @@ -45,7 +45,7 @@ * This class implements a symbolic regression problem. The example * below shows a typical usage of the {@code Regression} class. * - *error = Error.of(LossFunction::mse); - * } {@code + * {@snippet lang="java": * public class SymbolicRegression { * private static final ISeq+ * } * * @see SampleBuffer * @see Sampling diff --git a/jenetics.tool/src/main/java/io/jenetics/tool/trial/SampleSummaryStatistics.java b/jenetics.tool/src/main/java/io/jenetics/tool/trial/SampleSummaryStatistics.java index e804d27e7e..2254ae7993 100644 --- a/jenetics.tool/src/main/java/io/jenetics/tool/trial/SampleSummaryStatistics.java +++ b/jenetics.tool/src/main/java/io/jenetics/tool/trial/SampleSummaryStatistics.java @@ -34,14 +34,14 @@ * variance, skewness and kurtosis. The design of this class is similar to the * {@link java.util.DoubleSummaryStatistics} class. * - *> OPERATIONS = * ISeq.of(MathOp.ADD, MathOp.SUB, MathOp.MUL); @@ -88,7 +88,7 @@ * System.out.println("Error: " + REGRESSION.error(tree)); * } * } - * } {@code + * {@snippet lang="java": * final Stream+ * } * *stream = ... * final SampleSummaryStatistics statistics = stream.collect( * () -> new SampleSummaryStatistics(parameterCount), * SampleSummaryStatistics::accept, * SampleSummaryStatistics::combine * ); - * } * Implementation note: @@ -141,11 +141,11 @@ public ISeq
getQuantiles() { * function to each input element, and returns moments-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @param parameterCount the number of parameter of the accumulated * {@code Sample} objects diff --git a/jenetics.xml/src/main/java/io/jenetics/xml/BoundedGeneCreator.java b/jenetics.xml/src/main/java/io/jenetics/xml/BoundedGeneCreator.java index a69ffe3c96..3269cd056e 100644 --- a/jenetics.xml/src/main/java/io/jenetics/xml/BoundedGeneCreator.java +++ b/jenetics.xml/src/main/java/io/jenetics/xml/BoundedGeneCreator.java @@ -35,9 +35,9 @@ public interface BoundedGeneCreator { /** * Create a new bounded gene from the given parameters. * - *stream = ... * final SampleSummaryStatistics statistics = stream * .collect(toDoubleMomentStatistics(parameterCount)); - * } {@code + * {@snippet lang="java": * final BoundedGeneCreator+ * } * * @param value the gene value * @param min the minimum value diff --git a/jenetics.xml/src/main/java/io/jenetics/xml/Readers.java b/jenetics.xml/src/main/java/io/jenetics/xml/Readers.java index 542f68203f..a0645d1b3e 100644 --- a/jenetics.xml/src/main/java/io/jenetics/xml/Readers.java +++ b/jenetics.xml/src/main/java/io/jenetics/xml/Readers.java @@ -52,16 +52,16 @@ * This class contains static fields and methods, for creating chromosome- and * genotype readers for different gene types. * - *creator = LongGene::of; - * } {@code - * final Reader+ * Readers.Genotype.reader(Readers.DoubleChromosome.reader()); + * } * * @author Franz Wilhelmstötter * @version 3.9 @@ -78,7 +78,6 @@ private Readers() {} *bgr = - * Readers.Genotype.reader(Readers.BitChromosome.reader())); + * {@snippet lang="java": + * final Reader > bgr = + * Readers.Genotype.reader(Readers.BitChromosome.reader()); * * final Reader > igr = - * Writers.Genotype.reader(Readers.IntegerChromosome.reader())); + * Writers.Genotype.reader(Readers.IntegerChromosome.reader()); * * final Reader > dgr = - * Readers.Genotype.reader(Readers.DoubleChromosome.reader())); - * } {@code *- * } */ public static final class BitChromosome { private BitChromosome() {} @@ -393,7 +392,7 @@ public static io.jenetics.LongChromosome read(final InputStream in) *11100011101011001010 * }0.43947528327497376 * * - * }
{@code + * {@snippet lang="java": * final Writer+ * } * * This class also contains some helper methods, which makes it easier to write * Jenetics domain objects to a given output stream. - *bgw = * Writers.Genotype.writer(Writers.BitChromosome.writer())); * @@ -56,16 +56,16 @@ * * final Writer > dgw = * Writers.Genotype.writer(Writers.DoubleChromosome.writer())); - * }
{@code + * {@snippet lang="java": * final List+ * } * * @author Franz Wilhelmstötter * @version 3.9 @@ -79,12 +79,12 @@ private Writers() {} * {@link io.jenetics.BitChromosome} objects. *> genotypes = ...; * try (OutputStream out = Files.newOutputStream(Paths.get("path"))) { * Writers.write(out, genotypes, Writers.BitChromosome.writer()); * } - * }
* Writer code - *
{@code + * {@snippet lang="java": * final BitChromosome value = BitChromosome.of(20, 0.5); * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * Writers.BitChromosome.writer().write(value, xml); * } - * }+ * } * * XML output *
{@code @@ -148,12 +148,12 @@ public static void write( * {@link io.jenetics.CharacterChromosome} objects. ** Writer code - *
{@code + * {@snippet lang="java": * final CharacterChromosome value = CharacterChromosome.of("ASDF", CharSeq.of("A-Z")); * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * Writers.CharacterChromosome.writer().write(value, xml); * } - * }+ * } * * XML output *{@code @@ -303,13 +303,13 @@ Writerwriter( * {@link io.jenetics.IntegerChromosome} objects. * * Writer code - *
{@code + * {@snippet lang="java": * 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); * } - * }+ * } * * XML output *{@code @@ -424,13 +424,13 @@ public static void write( * {@link io.jenetics.LongChromosome} objects. ** Writer code - *
{@code + * {@snippet lang="java": * final LongChromosome value = LongChromosome * .of(Long.MIN_VALUE, Long.MAX_VALUE, 3); * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * Writers.LongChromosome.writer().write(value, xml); * } - * }+ * } * * XML output *{@code @@ -543,12 +543,12 @@ public static void write( * {@link io.jenetics.DoubleChromosome} objects. ** Writer code - *
{@code + * {@snippet lang="java": * final DoubleChromosome value = DoubleChromosome.of(0.0, 1.0, 3); * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * Writers.DoubleChromosome.writer().write(value, xml); * } - * }+ * } * * XML output *{@code @@ -667,7 +667,7 @@ public static void write( * {@link io.jenetics.PermutationChromosome} objects. ** Writer code - *
{@code + * {@snippet lang="java": * final PermutationChromosome+ * } * * XML output *value = * PermutationChromosome.ofInteger(5) * @@ -677,7 +677,7 @@ public static void write( * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * Writers.PermutationChromosome.writer().write(value, xml); * } - * } {@code @@ -739,10 +739,10 @@ private static String toAlleleTypeName( * Create a writer for permutation-chromosomes. The valid alleles are * serialized by calling the {@link Object#toString()} method. Calling * this method is equivalent with: - *{@code + * {@snippet lang="java": * final Writer+ * } * * Example output: *writer = * PermutationChromosome.write(text().map(Objects::toString)); - * } {@code @@ -887,7 +887,7 @@ public static void write( * {@link io.jenetics.Genotype} objects. ** Writer code - *
{@code + * {@snippet lang="java": * final Genotype+ * } * * XML output *gt = Genotype.of( * DoubleChromosome.of(0.0, 1.0, 3), * DoubleChromosome.of(0.0, 1.0, 2) @@ -898,7 +898,7 @@ public static void write( * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * writer.write(value, xml); * } - * } {@code @@ -1044,7 +1044,7 @@ void write( * {@link io.jenetics.Genotype} objects. ** Writer code - *
{@code + * {@snippet lang="java": * final Genotype+ * } * *gt = Genotype.of( * DoubleChromosome.of(0.0, 1.0, 3), * DoubleChromosome.of(0.0, 1.0, 2) @@ -1056,7 +1056,7 @@ void write( * try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) { * writer.write(asList(value), xml); * } - * } {@code ** * Reader definition - *@@ -1092,10 +1092,10 @@ private Genotypes() {} * Create a writer for genotypes of arbitrary chromosomes. How to write the * genotype chromosomes is defined by the given {@link Writer}. The * following writer allows writing double-gene chromosomes: - * {@code + * {@snippet lang="java": * final Writer+ * } * * @param writer the chromosome writer * @param the allele type diff --git a/jenetics.xml/src/main/java/io/jenetics/xml/stream/Reader.java b/jenetics.xml/src/main/java/io/jenetics/xml/stream/Reader.java index 605c4a66fc..2b7e9910ca 100644 --- a/jenetics.xml/src/main/java/io/jenetics/xml/stream/Reader.java +++ b/jenetics.xml/src/main/java/io/jenetics/xml/stream/Reader.java @@ -43,7 +43,6 @@ /** * XML reader class, used for reading objects in XML format. - * * XML *>> writer = * Writers.Genotypes.writer(Writers.DoubleChromosome.writer()); - * } {@code *+ * }@@ -55,10 +54,10 @@ * - * }-88668137 * *{@code + * {@snippet lang="java": * final Reader+ * } * * @author Franz Wilhelmstötter * @version 3.9 @@ -135,13 +134,13 @@ enum Type { /** * Read the given type from the underlying XML stream {@code reader}. * - *reader = * elem( * (Object[] v) -> { @@ -70,7 +69,7 @@ * * return IntegerChromosome.of( * alleles.stream() - * .map(value -> IntegerGene.of(value, min, max) + * .map(value -> IntegerGene.of(value, min, max)) * .toArray(IntegerGene[]::new) * ); * }, @@ -82,7 +81,7 @@ * elems(elem("allele", text().map(Integer::parseInt))) * ) * ); - * } {@code + * {@snippet lang="java": * try (AutoCloseableXMLStreamReader xml = XML.reader(in)) { - * // Move XML stream to first element. + * // Move XML stream to first the element. * xml.next(); * return reader.read(xml); * } - * }+ * } * * @param xml the underlying XML stream {@code reader} * @return the data read from the XML stream, maybe {@code null} @@ -208,10 +207,10 @@ public String toString() { * Return a {@code Reader} for reading an attribute of an element. ** XML - *
{@code+ *} {@code} * * Reader definition - * {@code + * {@snippet lang="java": * final Readerreader = * elem( * v -> (Integer)v[0], @@ -232,10 +231,10 @@ public static Reader attr(final String name) { * Return a {@code Reader} for reading the text of an element. * * XML - *
{@code+ *1234 } {@code1234 } * * Reader definition - * {@code + * {@snippet lang="java": * final Readerreader = * elem( * v -> (Integer)v[0], @@ -256,10 +255,10 @@ public static Reader text() { * * * XML - *
{@code+ *1234 } {@code1234 } * * Reader definition - * {@code + * {@snippet lang="java": * final Reader* * Reader definition - *reader = * elem( * v -> { @@ -301,10 +300,12 @@ public static Reader elem( * the given parent element {@code name}. * * XML - *
{@code+ *} 1234 {@code + ** * Reader definition - *} + * 1234 {@code + * {@snippet lang="java": * final Reader+ * } * * @param name the parent element name * @param reader the child elements reader @@ -358,14 +359,14 @@ public staticreader = * elem("min", * elem( @@ -318,7 +319,7 @@ public static Reader elem( * text().map(Integer::parseInt) * ) * ); - * } Reader elem( * } {@code + * {@snippet lang="java": * Reader+ * } * * @param reader the child element reader * @param> reader = * elem( * v -> (List
)v[0], * "properties", * elems(elem("property", text().map(Integer::parseInt))) * ); - * } the element type diff --git a/jenetics.xml/src/main/java/io/jenetics/xml/stream/Writer.java b/jenetics.xml/src/main/java/io/jenetics/xml/stream/Writer.java index 9810f779b7..a85cfde626 100644 --- a/jenetics.xml/src/main/java/io/jenetics/xml/stream/Writer.java +++ b/jenetics.xml/src/main/java/io/jenetics/xml/stream/Writer.java @@ -43,7 +43,7 @@ * * The XML has been written by the following {@code Writer} definition. * - * {@code + * {@snippet lang="java": * final Writer+ * } * * How to write the XML writing is shown by the next code snippet. * - *writer = * elem("int-chromosome", * attr("length").map(ch -> ch.length()), @@ -54,16 +54,16 @@ * .map(ch -> ISeq.of(ch).map(g -> g.getAllele())) * ) * ); - * } {@code + * {@snippet lang="java": * final IntegerChromosome ch = IntegerChromosome.of(MIN_VALUE, MAX_VALUE, 3); * try (AutoCloseableXMLStreamWriter xml = XML.writer(out, indent)) { * write(ch, xml); * } - * }+ * } * * @author Franz Wilhelmstötter * @version 3.9 @@ -120,9 +120,9 @@ default Writer map(final Function super B, ? extends T> mapper) { * Writes the attribute with the given {@code name} to the current * outer element. * - *{@code + * {@snippet lang="java": * final Writer+ * } * * @see #attr(String, Object) * @@ -145,9 +145,9 @@ staticwriter1 = elem("element", attr("attribute")); - * } Writer attr(final String name) { * Writes the attribute with the given {@code name} and a constant * {@code value} to the current outer element. * - * {@code + * {@snippet lang="java": * final Writer+ * } * * @param name the attribute name * @param value the attribute value diff --git a/jenetics.xml/src/main/java/io/jenetics/xml/stream/XML.java b/jenetics.xml/src/main/java/io/jenetics/xml/stream/XML.java index 1881021bc3..630d967762 100644 --- a/jenetics.xml/src/main/java/io/jenetics/xml/stream/XML.java +++ b/jenetics.xml/src/main/java/io/jenetics/xml/stream/XML.java @@ -34,28 +34,28 @@ * {@link javax.xml.stream.XMLStreamWriter} objects. *= elem("element", attr("version", "1.0")); - * } * Creating a new XML stream reader: - *
{@code + * {@snippet lang="java": * try (AutoCloseableXMLStreamReader xml = XML.reader(in)) { * // Move XML stream to first element. * xml.next(); * return reader.read(xml); * } - * }+ * } * * Create a new XML stream reader: - *{@code + * {@snippet lang="java": * try (AutoCloseableXMLStreamWriter xml = XML.writer(out)) { * writer.write(value, xml); * } - * }+ * } * * Create a new XML stream reader with pretty-print-indentation: - *{@code + * {@snippet lang="java": * final String indent = " "; * try (AutoCloseableXMLStreamWriter xml = XML.writer(out, indent)) { * writer.write(value, xml); * } - * }+ * } * * @author Franz Wilhelmstötter * @version 3.9 @@ -70,13 +70,13 @@ private XML() {} * The caller is responsible for closing the returned {@code XMLStreamReader}. * * - *{@code + * {@snippet lang="java": * try (AutoCloseableXMLStreamReader xml = XML.reader(in)) { * // Move XML stream to first element. * xml.next(); * return reader.read(xml); * } - * }+ * } * * @param input the input stream * @return a new {@code Closeable} XML stream reader @@ -102,11 +102,11 @@ public static AutoCloseableXMLStreamReader reader(final InputStream input) * The caller is responsible for closing the returned {@code XMLStreamWriter}. * * - *{@code + * {@snippet lang="java": * try (AutoCloseableXMLStreamWriter xml = XML.writer(out, " ")) { * writer.write(value, xml); * } - * }+ * } * * @param output the underlying output stream * @param indent the element indent used for the XML output @@ -138,11 +138,11 @@ public static AutoCloseableXMLStreamWriter writer( * The caller is responsible for closing the returned {@code XMLStreamWriter}. * * - *{@code + * {@snippet lang="java": * try (AutoCloseableXMLStreamWriter xml = XML.writer(out)) { * writer.write(value, xml); * } - * }+ * } * * @param output the underlying output stream * @return a new {@code XMLStreamWriter} instance diff --git a/jenetics/src/main/java/io/jenetics/Alterer.java b/jenetics/src/main/java/io/jenetics/Alterer.java index a63658a6bb..34a854a706 100644 --- a/jenetics/src/main/java/io/jenetics/Alterer.java +++ b/jenetics/src/main/java/io/jenetics/Alterer.java @@ -29,7 +29,7 @@ * Alterers can be chained by appending a list of alterers with the * {@link io.jenetics.engine.Engine.Builder#alterers(Alterer, Alterer[])} method. * - *{@code + * {@snippet lang="java": * final Engine+ * } * * The order of the alterer calls is: Crossover, Mutation and MeanAlterer. * diff --git a/jenetics/src/main/java/io/jenetics/AnyChromosome.java b/jenetics/src/main/java/io/jenetics/AnyChromosome.java index 8a4470f536..f46904794d 100644 --- a/jenetics/src/main/java/io/jenetics/AnyChromosome.java +++ b/jenetics/src/main/java/io/jenetics/AnyChromosome.java @@ -32,7 +32,7 @@ * {@code Chromosome} implementation, which allows to create genes without * explicit implementing the {@code Chromosome} interface. * - *engine = Engine * .builder(gtf, ff) * .alterers( @@ -38,7 +38,7 @@ * new MeanAlterer<>(0.2)) * .build(); * final EvolutionStream stream = engine.stream(); - * } {@code + * {@snippet lang="java": * public class LastMonday { * * // First monday of 2015. @@ -70,7 +70,7 @@ * } * * } - * }+ * } * * The full example above shows how the {@code AnyChromosome} is used * to use it for an allele-type with no predefined gene- and chromosome type. diff --git a/jenetics/src/main/java/io/jenetics/AnyGene.java b/jenetics/src/main/java/io/jenetics/AnyGene.java index 995aaf5c0f..e8d64f1e5f 100644 --- a/jenetics/src/main/java/io/jenetics/AnyGene.java +++ b/jenetics/src/main/java/io/jenetics/AnyGene.java @@ -35,7 +35,7 @@ * {@code Gene} implementation, which allows to create genes without explicit * implementing the {@code Gene} interface. * - *{@code + * {@snippet lang="java": * class Main { * // First monday of 2015. * private static final LocalDate MIN_MONDAY = LocalDate.of(2015, 1, 5); @@ -51,7 +51,7 @@ * // gene.newInstance(), are calling the 'newRandomMonday' method. * final AnyGene+ * } * The example above shows how to create {@code LocalDate} genes from a random * {@code LocalDate} supplier. It also shows how to implement a restriction on * the created dates. The usage of the {@code AnyGene} class is useful for diff --git a/jenetics/src/main/java/io/jenetics/CharacterChromosome.java b/jenetics/src/main/java/io/jenetics/CharacterChromosome.java index f99f0dd58f..5a30aa5562 100644 --- a/jenetics/src/main/java/io/jenetics/CharacterChromosome.java +++ b/jenetics/src/main/java/io/jenetics/CharacterChromosome.java @@ -123,7 +123,7 @@ public CharacterChromosome newInstance() { * by applying the given mapper function {@code f}. The mapped gene values * are then wrapped into a newly created chromosome. * - *gene = AnyGene.of(Main::nextRandomMonday); * } - * } {@code + * {@snippet lang="java": * final CharacterChromosome chromosome = ...; * final CharacterChromosome uppercase = chromosome.map(Main::uppercase); * @@ -133,7 +133,7 @@ public CharacterChromosome newInstance() { * } * return values; * } - * }+ * } * * @since 6.1 * diff --git a/jenetics/src/main/java/io/jenetics/Chromosome.java b/jenetics/src/main/java/io/jenetics/Chromosome.java index 68854425ba..7f0d6d5dde 100644 --- a/jenetics/src/main/java/io/jenetics/Chromosome.java +++ b/jenetics/src/main/java/io/jenetics/Chromosome.java @@ -83,17 +83,17 @@ default boolean isValid() { * Casts this {@code Chromosome} to an instance of type {@code C}. * This is a convenient method for an ordinary cast and allows seamless * method-chaining. Instead of - *{@code + * {@snippet lang="java": * final Genotype+ * } * you can write - *gt = ... * final int count = ((BitChromosome)gt.chromosome()).bitCount() - * } {@code + * {@snippet lang="java": * final Genotype+ * } * This may lead to a more elegant programming style in some cases. * * @since 3.7 diff --git a/jenetics/src/main/java/io/jenetics/DoubleChromosome.java b/jenetics/src/main/java/io/jenetics/DoubleChromosome.java index 45efff4276..82fc65585b 100644 --- a/jenetics/src/main/java/io/jenetics/DoubleChromosome.java +++ b/jenetics/src/main/java/io/jenetics/DoubleChromosome.java @@ -97,7 +97,7 @@ public DoubleChromosome newInstance() { * by applying the given mapper function {@code f}. The mapped gene values * are then wrapped into a newly created chromosome. * - *gt = ... * final int count = gt.chromosome() * .as(BitChromosome.class) * .bitCount() - * } {@code + * {@snippet lang="java": * final DoubleChromosome chromosome = ...; * final DoubleChromosome normalized = chromosome.map(Main::normalize); * @@ -108,7 +108,7 @@ public DoubleChromosome newInstance() { * } * return values; * } - * }+ * } * * @since 6.1 * diff --git a/jenetics/src/main/java/io/jenetics/EliteSelector.java b/jenetics/src/main/java/io/jenetics/EliteSelector.java index 4672680556..3a7da1f28b 100644 --- a/jenetics/src/main/java/io/jenetics/EliteSelector.java +++ b/jenetics/src/main/java/io/jenetics/EliteSelector.java @@ -38,14 +38,14 @@ * A problem with elitism is that it may cause the GA to converge to a local * optimum, so pure elitism is a race to the nearest local optimum. * - *{@code + * {@snippet lang="java": * final Selector+ * } * * @author Franz Wilhelmstötter * @version 5.0 diff --git a/jenetics/src/main/java/io/jenetics/EnumGene.java b/jenetics/src/main/java/io/jenetics/EnumGene.java index fed9495c7f..60e2d31b27 100644 --- a/jenetics/src/main/java/io/jenetics/EnumGene.java +++ b/jenetics/src/main/java/io/jenetics/EnumGene.java @@ -36,22 +36,22 @@ * * The following code shows how to create a combinatorial genotype factory which * can be used when creating an {@link io.jenetics.engine.Engine} instance. - *selector = new EliteSelector<>( * // Number of best individuals preserved for next generation: elites * 3, * // Selector used for selecting rest of population. * new RouletteWheelSelector<>() * ); - * } {@code + * {@snippet lang="java": * final ISeq+ * } * * The following code shows the assurances of the {@code EnumGene}. - *alleles = ISeq.of(1, 2, 3, 4, 5, 6, 7, 8); * final Factory >> gtf = Genotype.of( * PermutationChromosome.of(alleles) * ); - * } {@code + * {@snippet lang="java": * final ISeq+ * } * * @see PermutationChromosome * @see PartiallyMatchedCrossover diff --git a/jenetics/src/main/java/io/jenetics/Genotype.java b/jenetics/src/main/java/io/jenetics/Genotype.java index 49ac0813be..bab7462dd8 100644 --- a/jenetics/src/main/java/io/jenetics/Genotype.java +++ b/jenetics/src/main/java/io/jenetics/Genotype.java @@ -50,14 +50,14 @@ * a chromosome have the same constraints; e.g., the same min- and max values * for the genes value. * - *alleles = ISeq.of(1, 2, 3, 4, 5, 6, 7, 8); * final EnumGene gene = new EnumGene<>(5, alleles); * * assert(gene.alleleIndex() == 5); * assert(gene.allele() == gene.validAlleles().get(5)); * assert(gene.validAlleles() == alleles); - * } {@code + * {@snippet lang="java": * final Genotype+ * } * The code snippet above creates a genotype with the same structure as shown in * the figure above. In this example the {@link DoubleGene} has been chosen as * a gene type. @@ -132,10 +132,10 @@ public int length() { /** * Return the first chromosome. This is an alias for - *genotype = Genotype.of( * DoubleChromosome.of(0.0, 1.0, 8), * DoubleChromosome.of(1.0, 2.0, 10), * DoubleChromosome.of(0.0, 10.0, 9), * DoubleChromosome.of(0.1, 0.9, 5) * ); - * } {@code + * {@snippet lang="java": * final Genotype+ * } * * @since 5.2 * @@ -148,10 +148,10 @@ public Chromosome; gt = ... * final Chromosome chromosome = gt.get(0); - * } chromosome() { /** * Return the first {@link Gene} of the first {@link Chromosome} of this * {@code Genotype}. This is an alias for - * {@code + * {@snippet lang="java": * final Genotype+ * } * * @since 5.2 * @@ -268,10 +268,10 @@ public staticgt = ... * final DoubleGene gene = gt.get(0).get(0); - * } > Genotype of( * for easily creating a gene matrix. The following example will * create a 10x5 {@code DoubleGene} matrix. * - * {@code + * {@snippet lang="java": * final Genotype+ * } * * @since 3.0 * diff --git a/jenetics/src/main/java/io/jenetics/IntegerChromosome.java b/jenetics/src/main/java/io/jenetics/IntegerChromosome.java index 103a60e794..f99d613b36 100644 --- a/jenetics/src/main/java/io/jenetics/IntegerChromosome.java +++ b/jenetics/src/main/java/io/jenetics/IntegerChromosome.java @@ -95,7 +95,7 @@ public IntegerChromosome newInstance() { * by applying the given mapper function {@code f}. The mapped gene values * are then wrapped into a newly created chromosome. * - *gt = Genotype * .of(DoubleChromosome.of(0.0, 1.0, 10), 5); - * } {@code + * {@snippet lang="java": * final IntegerChromosome chromosome = ...; * final IntegerChromosome halved = chromosome.map(Main::half); * @@ -105,7 +105,7 @@ public IntegerChromosome newInstance() { * } * return values; * } - * }+ * } * * @since 6.1 * diff --git a/jenetics/src/main/java/io/jenetics/LongChromosome.java b/jenetics/src/main/java/io/jenetics/LongChromosome.java index 1f3188f0e9..8ced65d5fb 100644 --- a/jenetics/src/main/java/io/jenetics/LongChromosome.java +++ b/jenetics/src/main/java/io/jenetics/LongChromosome.java @@ -99,7 +99,7 @@ public LongChromosome newInstance() { * by applying the given mapper function {@code f}. The mapped gene values * are then wrapped into a newly created chromosome. * - *{@code + * {@snippet lang="java": * final LongChromosome chromosome = ...; * final LongChromosome halved = chromosome.map(Main::half); * @@ -109,7 +109,7 @@ public LongChromosome newInstance() { * } * return values; * } - * }+ * } * * @since 6.1 * diff --git a/jenetics/src/main/java/io/jenetics/Optimize.java b/jenetics/src/main/java/io/jenetics/Optimize.java index bf5ae4c0ee..9367d1f0a8 100644 --- a/jenetics/src/main/java/io/jenetics/Optimize.java +++ b/jenetics/src/main/java/io/jenetics/Optimize.java @@ -61,19 +61,19 @@ int compare(final T a, final T b) { * to make it {@code null}-friendly, you can wrap it with the * {@link Comparator#nullsFirst(Comparator)} method. * - *{@code + * {@snippet lang="java": * final Comparator+ * } * or - *comparator = nullsFirst(Optimize.MAXIMUM::compare); * assertEquals(comparator.compare(null, null), 0); * assertEquals(comparator.compare(null, 4), -1); * assertEquals(comparator.compare(4, null), 1); - * } {@code + * {@snippet lang="java": * final Comparator+ * } * * @paramcomparator = nullsFirst(Optimize.MINIMUM::compare); * assertEquals(comparator.compare(null, null), 0); * assertEquals(comparator.compare(null, 4), -1); * assertEquals(comparator.compare(4, null), 1); - * } the comparable type * @param a the first object to be compared. @@ -91,10 +91,10 @@ int compare(final T a, final T b) { * sorted in descending order, according to the given definition * of better and worse. * - * {@code + * {@snippet lang="java": * final Population+ * } * * The code example above will populationSort the population according its * fitness values in ascending order, since lower values are better @@ -113,10 +113,10 @@ publicpopulation = ... * population.sort(Optimize.MINIMUM. descending()); - * } > Comparator descending() { * sorted in ascending order, according to the given definition * of better and worse. * - * {@code + * {@snippet lang="java": * final Population+ * } * * The code example above will populationSort the population according its * fitness values in descending order, since lower values are better @@ -148,11 +148,11 @@ publicpopulation = ... * population.sort(Optimize.MINIMUM. ascending()); - * } > C best(final C a, final C b) { * Return a {@code null}-friendly function which returns the best element of * two values. E.g. * - * {@code + * {@snippet lang="java": * assertNull(Optimize.MAXIMUM.+ * } * * @see #best(Comparable, Comparable) * @@ -189,11 +189,11 @@ publicbest().apply(null, null)); * assertEquals(Optimize.MAXIMUM. best().apply(null, 4), (Integer)4); * assertEquals(Optimize.MAXIMUM. best().apply(6, null), (Integer)6); - * } > C worst(final C a, final C b) { * Return a {@code null}-friendly function which returns the worst element * of two values. E.g. * - * {@code + * {@snippet lang="java": * assertNull(Optimize.MAXIMUM.+ * } * * @see #worst(Comparable, Comparable) * diff --git a/jenetics/src/main/java/io/jenetics/PartialAlterer.java b/jenetics/src/main/java/io/jenetics/PartialAlterer.java index e0e7fb4243..068841e799 100644 --- a/jenetics/src/main/java/io/jenetics/PartialAlterer.java +++ b/jenetics/src/main/java/io/jenetics/PartialAlterer.java @@ -33,7 +33,7 @@ /** * This alterer wraps a given alterer which works on a given section of the * genotype's chromosomes. - *worst().apply(null, null)); * assertEquals(Optimize.MAXIMUM. worst().apply(null, 4), (Integer)4); * assertEquals(Optimize.MAXIMUM. worst().apply(6, null), (Integer)6); - * } {@code + * {@snippet lang="java": * // The genotype prototype, consisting of 4 chromosomes * final Genotype+ * } * * If you are using chromosome indices which are greater or equal than the * number of chromosomes defined in the genotype, a diff --git a/jenetics/src/main/java/io/jenetics/PermutationChromosome.java b/jenetics/src/main/java/io/jenetics/PermutationChromosome.java index 1653e8eae6..e63bc91aa1 100644 --- a/jenetics/src/main/java/io/jenetics/PermutationChromosome.java +++ b/jenetics/src/main/java/io/jenetics/PermutationChromosome.java @@ -47,7 +47,7 @@ * This chromosome can be used to model permutations of a given (sub) set of * alleles. * - *gtf = Genotype.of( * DoubleChromosome.of(0, 1), @@ -55,7 +55,7 @@ * new GaussianMutator<>() * ) * .build(); - * } {@code + * {@snippet lang="java": * final ISeq+ * } * * Usable {@link Alterer} for this chromosome: *alleles = ISeq.of("one", "two", "three", "four", "five"); * * // Create a new randomly permuted chromosome from the given alleles. @@ -65,7 +65,7 @@ * // > two|one|four|five|three * // > three|one|five * // > five|three|one - * } @@ -192,13 +192,13 @@ public String toString() { *
* The following example shows how to create a {@code PermutationChromosome} * for encoding a sub-set problem (of a fixed {@code length}). - *
{@code + * {@snippet lang="java": * final ISeq+ * } * * @since 3.4 * diff --git a/jenetics/src/main/java/io/jenetics/Selector.java b/jenetics/src/main/java/io/jenetics/Selector.java index 127293ecda..4d5a5e6efe 100644 --- a/jenetics/src/main/java/io/jenetics/Selector.java +++ b/jenetics/src/main/java/io/jenetics/Selector.java @@ -27,13 +27,13 @@ * the population. The selectors are used to divide the population into * survivors and offspring. The selectors for offspring and for the survivors * can be chosen independently. - *basicSet = ISeq.of("a", "b", "c", "d", "e", "f"); * * // The chromosome has a length of 3 and will only contain values from the * // given basic-set, with no duplicates. * final PermutationChromosome ch = PermutationChromosome.of(basicSet, 3); - * } {@code + * {@snippet lang="java": * final Engine+ * } * * @paramengine = Engine * .builder(gtf, ff) * .offspringSelector(new RouletteWheelSelector<>()) * .survivorsSelector(new TournamentSelector<>()) * .build(); - * } The gene type this GA evaluates, * @param The result type (of the fitness function). diff --git a/jenetics/src/main/java/io/jenetics/engine/Codec.java b/jenetics/src/main/java/io/jenetics/engine/Codec.java index 8d69122b06..c45b3d5137 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Codec.java +++ b/jenetics/src/main/java/io/jenetics/engine/Codec.java @@ -37,7 +37,7 @@ * a {@code Codec} class. The example given in the {@link Engine} documentation * can be simplified as follows: * - * {@code + * {@snippet lang="java": * public class RealFunction { * // The conversion from the 'Genotype' to the argument type of the fitness * // function is performed by the given 'Codec'. You can concentrate on the @@ -55,16 +55,16 @@ * ... * } * } - * }+ * } * * The {@code Codec} needed for the above usage example, will look like this: - *{@code + * {@snippet lang="java": * final DoubleRange domain = DoubleRange.of(0, 2*PI); * final Codec+ * } * * Calling the {@link Codec#of(Factory, Function)} method is the usual way for * creating new {@code Codec} instances. @@ -88,11 +88,11 @@ public interface Codeccodec = Codec.of( * Genotype.of(DoubleChromosome.of(domain)), * gt -> gt.chromosome().gene().allele() * ); - * } > { * must work together with the {@link #decoder()} function, which transforms * the genotype into an object of the problem domain. * - * {@code + * {@snippet lang="java": * final Codec+ * } * * @see #decoder() * @@ -113,12 +113,12 @@ public interface Codeccodec = ... * final Genotype gt = codec.encoding().newInstance(); * final SomeObject arg = codec.decoder().apply(gt); - * } > { /** * Converts the given {@link Genotype} to the target type {@link T}. This is * a shortcut for - * {@code + * {@snippet lang="java": * final Codec+ * } * * @since 3.6 * @@ -137,15 +137,15 @@ default T decode(final Genotypecodec = ... * final Genotype gt = codec.encoding().newInstance(); * * final SomeObject arg = codec.decoder().apply(gt); - * } genotype) { * between {@code [0..1)}. Instead, the values now follow an exponential * function. * - * {@code + * {@snippet lang="java": * final Codec+ * } * * This method can also be used for creating non-trivial codes like split * ranges, as shown in the following example, where only values between * [0, 2) and [8, 10) are valid. - *c = Codecs.ofScalar(DoubleRange.of(0, 1)) * .map(Math::exp); - * } {@code + * {@snippet lang="java": * +--+--+--+--+--+--+--+--+--+--+ * | | | | | | | | | | | * 0 1 2 3 4 5 6 7 8 9 10 @@ -153,9 +153,9 @@ default T decode(final Genotype+ * } * - *genotype) { * ^ |llllllll|rrrrrrrr| ^ * | | | | * +-------+ +------+ - * } {@code + * {@snippet lang="java": * final Codec+ * } * * @since 4.0 * @@ -245,7 +245,7 @@ public Functioncodec = Codecs * .ofScalar(DoubleRange.of(0, 10)) * .map(v -> { @@ -164,7 +164,7 @@ default T decode(final Genotype genotype) { * } * return v; * }); - * } , T> decoder() { * two {@code LocalDate} object (these are the argument types of the * component codecs) to a {@code Duration}. * - * {@code + * {@snippet lang="java": * final Codec+ * } * * @since 3.3 * @@ -310,7 +310,7 @@ static > CodecdateCodec1 = Codec.of( * Genotype.of(LongChromosome.of(0, 10_000)), * gt -> LocalDate.ofEpochDay(gt.gene().longValue()) @@ -274,7 +274,7 @@ public Function , T> decoder() { * final Duration duration = durationCodec.decoder() * .apply(pt.genotype()); * System.out.println(duration); - * } of( * a problem into sub problems and combine them again. * * The following example combines more than two sub-codecs into one. - *
{@code + * {@snippet lang="java": * final Codec+ * } * * @since 3.3 * diff --git a/jenetics/src/main/java/io/jenetics/engine/Codecs.java b/jenetics/src/main/java/io/jenetics/engine/Codecs.java index 7074d7bf6a..626a9b42d4 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Codecs.java +++ b/jenetics/src/main/java/io/jenetics/engine/Codecs.java @@ -131,7 +131,7 @@ private Codecs() {} *dateCodec = Codec.of( * Genotype.of(LongChromosome.of(0, 10_000)), * gt -> LocalDate.ofEpochDay(gt.getGene().longValue()) @@ -341,7 +341,7 @@ static > Codec of( * final Duration duration = durationCodec.decoder() * .apply(pt.genotype()); * System.out.println(duration); - * } * The following example shows a codec which creates and verifies * {@code BigInteger} objects. - *
{@code + * {@snippet lang="java": * final Codec+ * } * * @see AnyGene#of(Supplier, Predicate) * @see AnyChromosome#of(Supplier, Predicate) @@ -470,7 +470,7 @@ public static InvertibleCodec> codec = Codecs.of( * // Create new random 'BigInteger' object. * () -> { @@ -142,7 +142,7 @@ private Codecs() {} * // Verify that bit 7 is set. (For illustration purpose.) * bi -> bi.testBit(7) * ); - * } ofVector( * * The following example shows a codec which creates and verifies * {@code BigInteger} object arrays. - *
{@code + * {@snippet lang="java": * final Codec+ * } * * @see AnyChromosome#of(Supplier, Predicate, Predicate, int) * @@ -787,13 +787,13 @@ public static InvertibleCodec> codec = Codecs.of( * // Create new random 'BigInteger' object. * () -> { @@ -483,7 +483,7 @@ public static InvertibleCodec ofVector( * // The 'Chromosome' length. * 123 * ); - * } ofMatrix( * sequence. The returned mapping can be seen as a function which maps every * element of the {@code target} set to an element of the {@code source} set. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * If {@code source.size() > target.size()}, the created mapping is * surjective, @@ -924,13 +924,13 @@ private static Genotypenumbers = ISeq.of(1, 2, 3, 4, 5); * final ISeq strings = ISeq.of("1", "2", "3"); * * final Codec > toEncoding( * sequence. The returned mapping can be seen as a function which maps every * element of the {@code target} set to an element of the {@code source} set. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * If {@code source.size() > target.size()}, the created mapping is * surjective, @@ -964,7 +964,7 @@ private static Genotypenumbers = ISeq.of(1, 2, 3, 4, 5); * final ISeq strings = ISeq.of("1", "2", "3"); * * final Codec > toEncoding( * * The following code snippet shows a simplified variation of the Knapsack * problem. - *
{@code + * {@snippet lang="java": * public final class Main { * // The basic set from where to choose an 'optimal' subset. * private final static ISeq+ * } * * @paramSET = @@ -985,7 +985,7 @@ private static Genotype > toEncoding( * ... * } * } - * } the element type of the basic set * @param basicSet the basic set, from where to choose the optimal diff --git a/jenetics/src/main/java/io/jenetics/engine/Constraint.java b/jenetics/src/main/java/io/jenetics/engine/Constraint.java index cbfa5a4559..988145659b 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Constraint.java +++ b/jenetics/src/main/java/io/jenetics/engine/Constraint.java @@ -37,14 +37,14 @@ * is possible to repair invalid individuals. The evolution * {@link Engine} is using the constraint in the following way: check the validity * and repair invalid individuals. - * {@code + * {@snippet lang="java": * for (int i = 0; i < population.size(); ++i) { * final Phenotype+ * } * * Noteindividual = population.get(i); * if (!constraint.test(individual)) { * population.set(i, constraint.repair(individual, generation)); * } * } - * }
* Keep in mind, that this interface only repairs invalid individuals, which @@ -55,19 +55,19 @@ * factory which obeys {@code this} constraint. The following code will show * how to create such a constrained genotype factory and use it for * creating an evolution engine. - *{@code + * {@snippet lang="java": * final Constraint+ * } * * The following example illustrates how a constraint which its repair function * can be look like. Imagine that your problem domain consists of double values * between [0, 2) and [8, 10). Since it is not possible - *constraint = ...; * final Factory > gtf = ...; * final Engine engine = Engine * .builder(fitness, constraint.constrain(gtf)) * .constraint(constraint) * .build(); - * } {@code + * {@snippet lang="java": * +--+--+--+--+--+--+--+--+--+--+ * | | | | | | | | | | | * 0 1 2 3 4 5 6 7 8 9 10 @@ -75,14 +75,14 @@ * ^ |llllllll|rrrrrrrr| ^ * | | | | * +-------+ +------+ - * }+ * } * The invalid range is marked with {@code x}. Repairing an invalid value will * map values in the {@code l} range on the valid range [0, 2), and * value in the {@code r} range on the valid range [8, 10). This mapping * guarantees an even distribution of the values in the valid ranges, which is * an important characteristic of the repair function. * - *{@code + * {@snippet lang="java": * final InvertibleCodec+ * } * * Alternative solutioncodec = Codecs.ofScalar(DoubleRange.of(0, 10)); * final Constraint constraint = Constraint.of( * codec, @@ -94,14 +94,14 @@ * return v; * } * ); - * }
* Instead of repairing individuals, it is better to not create invalid one in * the first place. Once you have a proper repair strategy, you can use * it to create a {@link Codec} which only creates valid individuals, using your * repair method. - *{@code + * {@snippet lang="java": * final Codec+ * } * The same example with an {@link InvertibleCodec} will look like this: - *codec = Codecs * .ofScalar(DoubleRange.of(0, 10)) * .map(v -> { @@ -110,9 +110,9 @@ * } * return v; * }); - * } {@code + * {@snippet lang="java": * final InvertibleCodec+ * } * * @see Engine.Builder#constraint(Constraint) * @see RetryConstraint @@ -183,14 +183,14 @@ Phenotypecodec = Codecs * .ofScalar(DoubleRange.of(0, 10)) * .map(v -> { @@ -122,7 +122,7 @@ * return v; * }, * Function.identity()); - * } repair( * create an evolution engine, where also the genotype factory will only * create valid individuals. * - * {@code + * {@snippet lang="java": * final Constraint+ * } * * @since 6.1 * diff --git a/jenetics/src/main/java/io/jenetics/engine/Engine.java b/jenetics/src/main/java/io/jenetics/engine/Engine.java index d856cb1787..9b59cd5fd8 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Engine.java +++ b/jenetics/src/main/java/io/jenetics/engine/Engine.java @@ -52,7 +52,7 @@ * Genetic algorithm engine which is the main class. The following * example shows the main steps in initializing and executing the GA. * - *constraint = ...; * final Factory > gtf = ...; * final Engine engine = Engine * .builder(fitness, constraint.constrain(gtf)) * .constraint(constraint) * .build(); - * } {@code + * {@snippet lang="java": * public class RealFunction { * // Definition of the fitness function. * private static Double eval(final Genotype+ * } * * The architecture allows to decouple the configuration of the engine from the * execution. The {@code Engine} is configured via the {@code Engine.Builder} @@ -98,7 +98,7 @@ * method. If you want to use a different executor for evaluating the fitness * functions, you have to set the {@link Builder#fitnessExecutor(BatchExecutor)}. * - *gt) { @@ -83,7 +83,7 @@ * .collect(toBestPhenotype()); * } * } - * } {@code + * {@snippet lang="java": * final Engine+ * } * * @implNote * This class is thread safe: The engine maintains no mutable state. @@ -1284,11 +1284,11 @@ public Builderengine = Engine * .builder(...) * // Using this execution service for parallelize the evolution steps. @@ -106,7 +106,7 @@ * // Using one virtual thread for every fitness function evaluation. * .batchExecutor(BatchExecutor.ofVirtualThreads()) * .build(); - * } copy() { * engine configurations. The following code snippet shows a possible usage * example. * - * {@code + * {@snippet lang="java": * final Engine+ * } * * @see Builder#setup(Setup) * diff --git a/jenetics/src/main/java/io/jenetics/engine/Evaluator.java b/jenetics/src/main/java/io/jenetics/engine/Evaluator.java index a8be563237..8845cf3a75 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Evaluator.java +++ b/jenetics/src/main/java/io/jenetics/engine/Evaluator.java @@ -35,7 +35,7 @@ * new {@link Phenotype} instance and return the newly created one. A simple * serial evaluator can easily implement: * - *engine = Engine.builder(problem) * .setup(new WeaselProgram<>()) * .build(); - * } {@code + * {@snippet lang="java": * final Function super Genotype+ * } * * @apiNote * The size of the returned, evaluated, phenotype sequence must be exactly diff --git a/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java b/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java index 00995130be..3f393f31be 100644 --- a/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java +++ b/jenetics/src/main/java/io/jenetics/engine/EvolutionResult.java @@ -55,14 +55,14 @@ * Represents a state of the GA after an evolution step. It also represents the * final state of an evolution process and can be created with an appropriate * collector: - *, ? extends C> fitness = ...; * final Evaluator evaluator = population -> population * .map(pt -> pt.eval(fitness)) @@ -43,7 +43,7 @@ * * final Engine engine = new Engine.Builder<>(evaluator, genotypeFactory) * .build(); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * @see EvolutionStart * @see Engine @@ -380,14 +380,14 @@ public boolean equals(final Object obj) { /** * Return a collector which collects the best result of an evolution stream. * - *, EnumGene , Double> tsm = ...; * final EvolutionResult , Double> result = Engine.builder(tsm) * .optimize(Optimize.MINIMUM).build() * .stream() * .limit(100) * .collect(EvolutionResult.toBestEvolutionResult()); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * If the collected {@link EvolutionStream} is empty, the collector returns * {@code null}. @@ -413,14 +413,14 @@ public boolean equals(final Object obj) { * Return a collector which collects the best phenotype of an evolution * stream. * - *, EnumGene , Double> tsm = ...; * final EvolutionResult , Double> result = Engine.builder(tsm) * .optimize(Optimize.MINIMUM).build() * .stream() * .limit(100) * .collect(EvolutionResult.toBestEvolutionResult()); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * If the collected {@link EvolutionStream} is empty, the collector returns * {@code null}. @@ -447,14 +447,14 @@ public boolean equals(final Object obj) { * Return a collector which collects the best genotype of an evolution * stream. * - *, EnumGene , Double> tsm = ...; * final Phenotype , Double> result = Engine.builder(tsm) * .optimize(Optimize.MINIMUM).build() * .stream() * .limit(100) * .collect(EvolutionResult.toBestPhenotype()); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * If the collected {@link EvolutionStream} is empty, the collector returns * {@code null}. @@ -483,14 +483,14 @@ public boolean equals(final Object obj) { * Return a collector which collects the best result (in the native * problem space). * - *, EnumGene , Double> tsm = ...; * final Genotype > result = Engine.builder(tsm) * .optimize(Optimize.MINIMUM).build() * .stream() * .limit(100) * .collect(EvolutionResult.toBestGenotype()); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * If the collected {@link EvolutionStream} is empty, the collector returns * {@code null}. @@ -526,14 +526,14 @@ public boolean equals(final Object obj) { * Return a collector which collects the best result (in the native * problem space). * - *, EnumGene , Double> tsm = ...; * final ISeq route = Engine.builder(tsm) * .optimize(Optimize.MINIMUM).build() * .stream() * .limit(100) * .collect(EvolutionResult.toBestResult(tsm.codec().decoder())); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * If the collected {@link EvolutionStream} is empty, the collector returns * {@code null}. @@ -558,7 +558,7 @@ public boolean equals(final Object obj) { * population and replaces it with newly created one by the given genotype * {@code factory}. * - *, EnumGene , Double> tsm = ...; * final ISeq route = Engine.builder(tsm) * .optimize(Optimize.MINIMUM).build() * .stream() * .limit(100) * .collect(EvolutionResult.toBestResult(tsm.codec())); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * @since 6.0 * @see Engine.Builder#interceptor(EvolutionInterceptor) @@ -633,7 +633,7 @@ EvolutionResultproblem = ...; * final Engine engine = Engine.builder(problem) * .interceptor(toUniquePopulation(problem.codec().encoding(), 100)) @@ -566,7 +566,7 @@ public boolean equals(final Object obj) { * final Genotype best = engine.stream() * .limit(100); * .collect(EvolutionResult.toBestGenotype()); - * } uniquePopulation( * population and replaces it with newly created one by the given genotype * {@code factory}. * - * {@code + * {@snippet lang="java": * final Problem+ * } * * @since 6.0 * @see Engine.Builder#interceptor(EvolutionInterceptor) @@ -665,7 +665,7 @@ EvolutionResultproblem = ...; * final Engine engine = Engine.builder(problem) * .interceptor(toUniquePopulation(problem.codec().encoding())) @@ -641,7 +641,7 @@ EvolutionResult uniquePopulation( * final Genotype best = engine.stream() * .limit(100); * .collect(EvolutionResult.toBestGenotype()); - * } uniquePopulation( * population and replaces it with newly created one by the existing * genotype factory. * - * {@code + * {@snippet lang="java": * final Problem+ * } * * @since 6.0 * @see Engine.Builder#interceptor(EvolutionInterceptor) @@ -700,7 +700,7 @@ EvolutionInterceptorproblem = ...; * final Engine engine = Engine.builder(problem) * .interceptor(toUniquePopulation(10)) @@ -673,7 +673,7 @@ EvolutionResult uniquePopulation( * final Genotype best = engine.stream() * .limit(100); * .collect(EvolutionResult.toBestGenotype(5)); - * } toUniquePopulation(final int maxRetries) { * population and replaces it with newly created one by the existing * genotype factory. * - * {@code + * {@snippet lang="java": * final Problem+ * } * * @since 6.0 * @see Engine.Builder#interceptor(EvolutionInterceptor) diff --git a/jenetics/src/main/java/io/jenetics/engine/EvolutionStatistics.java b/jenetics/src/main/java/io/jenetics/engine/EvolutionStatistics.java index f336f6f80b..434d928209 100644 --- a/jenetics/src/main/java/io/jenetics/engine/EvolutionStatistics.java +++ b/jenetics/src/main/java/io/jenetics/engine/EvolutionStatistics.java @@ -39,7 +39,7 @@ * following example shows how to integrate the statistics object into * your evolution stream. * - *problem = ...; * final Engine engine = Engine.builder(problem) * .interceptor(EvolutionResult.toUniquePopulation()) @@ -708,7 +708,7 @@ EvolutionInterceptor toUniquePopulation(final int maxRetries) { * final Genotype best = engine.stream() * .limit(100); * .collect(EvolutionResult.toBestGenotype()); - * } {@code + * {@snippet lang="java": * final Engine+ * } * * Example output * - *engine = ... * final EvolutionStatistics statistics = * EvolutionStatistics.ofNumber(); @@ -51,11 +51,11 @@ * .collect(toBestPhenotype()); * * System.println(statistics); - * } {@code + * {@snippet lang="java": * +---------------------------------------------------------------------------+ * | Time statistics | * +---------------------------------------------------------------------------+ @@ -81,7 +81,7 @@ * | var = 13006.132537301528 | * | std = 114.044432 | * +---------------------------------------------------------------------------+ - * }+ * } * * @author Franz Wilhelmstötter * @since 3.0 diff --git a/jenetics/src/main/java/io/jenetics/engine/EvolutionStream.java b/jenetics/src/main/java/io/jenetics/engine/EvolutionStream.java index beecbe26d4..3ec266dbe7 100644 --- a/jenetics/src/main/java/io/jenetics/engine/EvolutionStream.java +++ b/jenetics/src/main/java/io/jenetics/engine/EvolutionStream.java @@ -33,13 +33,13 @@ * * @implNote Collecting an empty {@code EvolutionStream} will return * {@code null}. - *{@code + * {@snippet lang="java": * final EvolutionResult+ * } * * @see java.util.stream.Stream * @see Engine @@ -61,25 +61,25 @@ public interface EvolutionStream< * when the given {@code proceed} predicate returns {@code false}. *result = engine.stream() * .limit(0) * .collect(toBestEvolutionResult()); * * assert result == null; - * } * General usage example: - *
{@code + * {@snippet lang="java": * final Phenotype+ * } * * Note: * The evolution result may be {@code null}, if your truncation * predicate returns {@code false} for the initial population. - *result = engine.stream() * // Truncate the evolution stream after 5 "steady" generations. * .limit(bySteadyFitness(5)) * // The evolution will stop after maximal 100 generations. * .limit(100) * .collect(toBestPhenotype()); - * } {@code + * {@snippet lang="java": * final EvolutionResult+ * } * * @see Limits * @@ -98,15 +98,15 @@ public interface EvolutionStream< * factory method is to simplify the creation of an {@code EvolutionStream} * from an own evolution (GA) engine. * - *result = engine.stream() * .limit(er -> false) * .collect(toBestEvolutionResult()); * * assert result == null; - * } {@code + * {@snippet lang="java": * final Supplier+ * } * * A more complete example for would look like as: * - *> start = ... * final EvolutionStream stream = * EvolutionStream.of(start, new MySpecialEngine()); - * } {@code + * {@snippet lang="java": * public final class SpecialEngine { * * // The fitness function. @@ -143,7 +143,7 @@ public interface EvolutionStream< * System.out.println(String.format("Best Genotype: %s", best)); * } * } - * }+ * } * * * @since 5.1 @@ -171,7 +171,7 @@ EvolutionStreamofEvolution( * Create a new evolution stream with an adjustable evolution * function. * - * {@code + * {@snippet lang="java": * public static void main(final String[] args) { * final Problem+ * } * * @see #ofEvolution(Supplier, Evolution) * diff --git a/jenetics/src/main/java/io/jenetics/engine/EvolutionStreamable.java b/jenetics/src/main/java/io/jenetics/engine/EvolutionStreamable.java index e0c0e28007..345af87cbc 100644 --- a/jenetics/src/main/java/io/jenetics/engine/EvolutionStreamable.java +++ b/jenetics/src/main/java/io/jenetics/engine/EvolutionStreamable.java @@ -85,10 +85,10 @@ public interface EvolutionStreamable< /** * Create a new, possibly infinite, evolution stream with a newly * created population. This method is a shortcut for - *problem = Problem.of( * v -> Math.sin(v[0])*Math.cos(v[1]), @@ -219,7 +219,7 @@ EvolutionStream ofEvolution( * .variance() * : 0.0; * } - * } {@code + * {@snippet lang="java": * final EvolutionStream+ * } * * @return a new evolution stream. */ @@ -120,7 +120,7 @@ default EvolutionStreamstream = streamable * .stream(() -> EvolutionStart.of(ISeq.empty(), 1)); - * } stream() { * of the given {@code result} and its total generation * {@link EvolutionResult#totalGenerations()}. * - * {@code + * {@snippet lang="java": * private static final Problem+ * } * * The example above shows how to save an {@link EvolutionResult} from a * first run, save it to disk and continue the evolution. diff --git a/jenetics/src/main/java/io/jenetics/engine/FitnessNullifier.java b/jenetics/src/main/java/io/jenetics/engine/FitnessNullifier.java index 167a47e4c1..d696e33f2d 100644 --- a/jenetics/src/main/java/io/jenetics/engine/FitnessNullifier.java +++ b/jenetics/src/main/java/io/jenetics/engine/FitnessNullifier.java @@ -31,7 +31,7 @@ * problems, like symbolic regression analyses with changing input data (time * series). * - ** PROBLEM = Problem.of( * x -> cos(0.5 + sin(x))*cos(x), @@ -152,7 +152,7 @@ default EvolutionStream stream() { * * System.out.println(result.bestPhenotype()); * } - * } {@code + * {@snippet lang="java": * final var nullifier = new FitnessNullifier+ * } * * @implNote * This interceptor is thread-safe and can be used from different threads. No diff --git a/jenetics/src/main/java/io/jenetics/engine/InvertibleCodec.java b/jenetics/src/main/java/io/jenetics/engine/InvertibleCodec.java index e38e12e73c..ad852ff14f 100644 --- a/jenetics/src/main/java/io/jenetics/engine/InvertibleCodec.java +++ b/jenetics/src/main/java/io/jenetics/engine/InvertibleCodec.java @@ -34,13 +34,13 @@ * inverse functionality of the codec. The following example shows the * relation between encoder and decoder function must fulfill. * - *(); * * final Engine engine = Engine.builder(problem) @@ -42,7 +42,7 @@ * // possible from a different thread. This forces the reevaluation of * // the fitness values at the start of the next generation. * nullifier.nullifyFitness(); - * } {@code + * {@snippet lang="java": * final InvertibleCodec+ * } * * The main usage of an invertible codec is to simplify the definition of * {@link Constraint} objects. Instead of working with the GA classes @@ -66,13 +66,13 @@ public interface InvertibleCodeccodec = * Codecs.ofVector(IntRange.of(0, 100), 6); * final int[] value = new int[]{3, 4, 6, 7, 8, 3}; * final Genotype gt = codec.encode(value); * assert Arrays.equals(value, codec.decode(gt)); - * } > extends Codec { * inverse of the {@link #decoder()} function. The following code * snippet shows how a given value in the native problem domain * can be converted into a {@link Genotype} and transformed back. - * {@code + * {@snippet lang="java": * final InvertibleCodec+ * } * * @see #decoder() * @see #encode(Object) @@ -98,7 +98,7 @@ default Genotypecodec = * Codecs.ofVector(IntRange.of(0, 100), 6); * final int[] value = new int[]{3, 4, 6, 7, 8, 3}; * final Genotype gt = codec.encode(value); * assert Arrays.equals(value, codec.decode(gt)); - * } encode(final T value) { * This method can also be used for creating non-trivial codes like split * ranges, as shown in the following example, where only values between * [0, 2) and [8, 10) are valid. - * {@code + * {@snippet lang="java": * +--+--+--+--+--+--+--+--+--+--+ * | | | | | | | | | | | * 0 1 2 3 4 5 6 7 8 9 10 @@ -106,9 +106,9 @@ default Genotype+ * } * - *encode(final T value) { * ^ |llllllll|rrrrrrrr| ^ * | | | | * +-------+ +------+ - * } {@code + * {@snippet lang="java": * final InvertibleCodec+ * } * * @see Codec#map(Function) * diff --git a/jenetics/src/main/java/io/jenetics/engine/Limits.java b/jenetics/src/main/java/io/jenetics/engine/Limits.java index 80d4905725..5b42a22ec8 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Limits.java +++ b/jenetics/src/main/java/io/jenetics/engine/Limits.java @@ -108,14 +108,14 @@ public boolean test(final Object o) { * better phenotype could be found after the given number of * {@code generations}. * - *codec = Codecs * .ofScalar(DoubleRange.of(0, 10)) * .map(v -> { @@ -118,7 +118,7 @@ default Genotype encode(final T value) { * return v; * }, * Function.identity()); - * } {@code + * {@snippet lang="java": * final Phenotype+ * } * * @param generations the number of steady generations * @paramresult = engine.stream() * // Truncate the evolution stream after 5 "steady" generations. * .limit(bySteadyFitness(5)) * // The evolution will stop after maximal 100 generations. * .limit(100) * .collect(toBestPhenotype()); - * } the fitness type @@ -135,14 +135,14 @@ Predicate > bySteadyFitness(final int generations) { * execution exceeds a given time duration. This predicate is (normally) * used as a safety net, for guaranteed stream truncation. * - * {@code + * {@snippet lang="java": * final Phenotype+ * } * * @since 3.1 * @@ -162,14 +162,14 @@ Predicateresult = engine.stream() * // Truncate the evolution stream after 5 "steady" generations. * .limit(bySteadyFitness(5)) * // The evolution will stop after maximal 500 ms. * .limit(byExecutionTime(Duration.ofMillis(500), Clock.systemUTC()) * .collect(toBestPhenotype()); - * } > bySteadyFitness(final int generations) { * execution exceeds a given time duration. This predicate is (normally) * used as a safety net, for guaranteed stream truncation. * - * {@code + * {@snippet lang="java": * final Phenotype+ * } * * @since 3.1 * @@ -192,7 +192,7 @@ Predicateresult = engine.stream() * // Truncate the evolution stream after 5 "steady" generations. * .limit(bySteadyFitness(5)) * // The evolution will stop after maximal 500 ms. * .limit(byExecutionTime(Duration.ofMillis(500)) * .collect(toBestPhenotype()); - * } > bySteadyFitness(final int generations) { * population becomes greater than the user-specified fitness threshold when * the objective is to maximize the fitness. * - * {@code + * {@snippet lang="java": * final Phenotype+ * } * * @since 3.1 * @@ -222,7 +222,7 @@ Predicateresult = engine.stream() * // Truncate the evolution stream if the best fitness is higher than * // the given threshold of '2.3'. @@ -201,7 +201,7 @@ Predicate > bySteadyFitness(final int generations) { * // the termination (truncation) of the evolution stream. * .limit(250) * .collect(toBestPhenotype()); - * } > byFitnessThreshold(final C threshold) { * fitness is converging. Two filters of different lengths are used to * smooth the best fitness across the generations. * - * {@code + * {@snippet lang="java": * final Phenotype+ * } * * In the example above, the moving average of the short- and long filter * is used for determining the fitness convergence. @@ -275,11 +275,11 @@ Predicateresult = engine.stream() * .limit(byFitnessConvergence(5, 15, (s, l) -> { * final double div = max(abs(s.getMean()), abs(l.getMean())); @@ -230,7 +230,7 @@ Predicate > byFitnessThreshold(final C threshold) { * return eps >= 10E-5 * })) * .collect(toBestPhenotype()); - * } > byFitnessConvergence( * away from the smoothed best fitness from the short filter, the fitness is * deemed as converged and the evolution terminates. * - * {@code + * {@snippet lang="java": * final Phenotype+ * } * * In the given example, the evolution stream stops, if the difference of the * mean values of the long and short filter is less than 1%. The short @@ -430,13 +430,13 @@ Predicateresult = engine.stream() * .limit(byFitnessConvergence(5, 15, 10E-4)) * .collect(toBestPhenotype()); - * } > byPopulationConvergence( * genotypes. * * This method is equivalent to the following code snippet: - *
{@code + * {@snippet lang="java": * final Predicate+ * } * * @since 4.0 * @see #byGeneConvergence(Predicate, double) diff --git a/jenetics/src/main/java/io/jenetics/engine/Problem.java b/jenetics/src/main/java/io/jenetics/engine/Problem.java index d8e6f296fe..26f3bc0638 100644 --- a/jenetics/src/main/java/io/jenetics/engine/Problem.java +++ b/jenetics/src/main/java/io/jenetics/engine/Problem.java @@ -32,7 +32,7 @@ * evolution {@code Engine}. It connects the actual {@link #fitness()} function * and the needed {@link #codec()}. * - *> limit = * byGeneConvergence( * stat -> stat.getMax()*convergenceRate <= stat.getMean(), * convergedGeneRate * ); - * } {@code + * {@snippet lang="java": * final Problem+ * } * * The example above shows the Ones-Counting problem definition. * @@ -95,12 +95,12 @@ default Optional, BitGene, Integer> counting = Problem.of( * // Native fitness function * genes -> (int)genes.stream() @@ -44,7 +44,7 @@ * gt -> ISeq.of(gt.chromosome()) * ) * ); - * } > constraint() { /** * Converts the given {@link Genotype} to the target type {@link T}. This is * a shortcut for - * {@code + * {@snippet lang="java": * final Problem+ * } * * @since 4.2 * diff --git a/jenetics/src/main/java/io/jenetics/engine/RetryConstraint.java b/jenetics/src/main/java/io/jenetics/engine/RetryConstraint.java index b2c2dca359..51ff6e94c9 100644 --- a/jenetics/src/main/java/io/jenetics/engine/RetryConstraint.java +++ b/jenetics/src/main/java/io/jenetics/engine/RetryConstraint.java @@ -39,13 +39,13 @@ * The following example constraint checks a 2-dimensional point for validity. * In this example, a point is considered as valid if it lies within the unit * circle. - *problem = ... * final Genotype gt = problem.codec().encoding().newInstance(); * * final SomeObject arg = problem.decode(gt); - * } {@code + * {@snippet lang="java": * InvertibleCodec+ * } * The probability that a randomly created point lies outside the unit circle is * 1 - π/4 ≈ 0.2146. This leads to a failure probability after 10 * tries of 0.214610 ≈ 0.000000207173567. Since we are diff --git a/jenetics/src/main/java/io/jenetics/internal/collection/BitArray.java b/jenetics/src/main/java/io/jenetics/internal/collection/BitArray.java index c194ff7d2a..e58e1e620c 100644 --- a/jenetics/src/main/java/io/jenetics/internal/collection/BitArray.java +++ b/jenetics/src/main/java/io/jenetics/internal/collection/BitArray.java @@ -213,11 +213,11 @@ public void shiftRight(final int n) { * Return the signum of the number, represented by this bit-array (-1 for * negative, 0 for zero, 1 for positive). * - *codec = Codecs.ofVector(DoubleRange.of(-1, 1), 2); * Constraint constraint = RetryConstraint.of( * codec, * p -> p[0]*p[0] + p[1]*p[1] <= 1 * ); - * } {@code + * {@snippet lang="java": * final BitArray bits = ...; * final BigInteger i = bits.toBigInteger(); * assert bits.signum() == i.signum(); - * }+ * } * * @return the signum of the number, represented by this bit-array (-1 for * negative, 0 for zero, 1 for positive) @@ -235,11 +235,11 @@ public int signum() { * bit-array can be recreated by the returned {@code BigInteger} value. But * only with the same {@link #length()} of {@code this} bit-array. * - *{@code + * {@snippet lang="java": * final var bits = BitArray.of("1111111010100110010110110010011110110101"); * final var bint = bits.toBigInteger(); * assert BitArray.of(bint, bits.length()).equals(bits); - * }+ * } * * @see #of(BigInteger, int) * @@ -279,11 +279,11 @@ private byte[] toTowsComplementByteArray() { * Return the {@code byte[]} array, which represents the state of the state * of {@code this} bit-array. * - *{@code + * {@snippet lang="java": * final BitArray bits = ...; * final byte[] bytes = bits.toByteArray(); * assert bits.equals(BitArray.of(bytes, bits.length())); - * }+ * } * * @return the bit-array data as {@code byte[]} array */ @@ -356,12 +356,12 @@ public String toByteString() { * is big enough to store the whole value. If the length is shorter than * required, the higher order bits will be truncated. * - *{@code + * {@snippet lang="java": * final var length = 2048; * final var bint = BigInteger.probablePrime(length, new Random()); * final var bits = BitArray.of(bint, length + 1); * assert bits3.toBigInteger().equals(bint); - * }+ * } * * @see #toBigInteger() * @@ -448,11 +448,11 @@ private static char get(final CharSequence chars, final int i, final int length) * created by the {@link #toString()} method, will be equals to the given * input {@code value}. * - *{@code + * {@snippet lang="java": * final var string = "11111110101001100101101100100111101101011101"; * final var bits = BitArray.of(string); * assert bits.toString().equals(string); - * }+ * } * * @see #toString() * diff --git a/jenetics/src/main/java/io/jenetics/internal/math/Basics.java b/jenetics/src/main/java/io/jenetics/internal/math/Basics.java index 2b063bbaaf..b4304148bc 100644 --- a/jenetics/src/main/java/io/jenetics/internal/math/Basics.java +++ b/jenetics/src/main/java/io/jenetics/internal/math/Basics.java @@ -139,7 +139,7 @@ public static long ulpDistance(final double a, final double b) { * Calculating the ULP * position of a double number. * - *{@code + * {@snippet lang="java": * double a = 0.0; * for (int i = 0; i < 10; ++i) { * a = Math.nextAfter(a, Double.POSITIVE_INFINITY); @@ -151,7 +151,7 @@ public static long ulpDistance(final double a, final double b) { * a + "\t" + ulpPosition(a) + "\t" + ulpDistance(0.0, a) * ); * } - * }+ * } * * The code fragment above will create the following output: *diff --git a/jenetics/src/main/java/io/jenetics/internal/math/Randoms.java b/jenetics/src/main/java/io/jenetics/internal/math/Randoms.java index f7df94d704..610a50a01d 100644 --- a/jenetics/src/main/java/io/jenetics/internal/math/Randoms.java +++ b/jenetics/src/main/java/io/jenetics/internal/math/Randoms.java @@ -218,11 +218,11 @@ public static byte[] seed(final byte[] seed) { * and {@code new Object().hashCode()} calls to create a reasonable safe * seed value: * - *{@code + * {@snippet lang="java": * public static long seed() { * return seed(System.nanoTime()); * } - * }+ * } * * This method passes all the statistical tests of the * @@ -244,7 +244,7 @@ public static long seed() { * value. This is done by combining it with values of * {@code new Object().hashCode()}: * - *{@code + * {@snippet lang="java": * public static long seed(final long base) { * final long objectHashSeed = ((long)(new Object().hashCode()) << 32) | * new Object().hashCode(); @@ -254,7 +254,7 @@ public static long seed() { * seed ^= seed << 8; * return seed; * } - * }+ * } * * @param base the base value of the seed to create * @return the created seed value. diff --git a/jenetics/src/main/java/io/jenetics/internal/util/Bits.java b/jenetics/src/main/java/io/jenetics/internal/util/Bits.java index c9d7f234f2..dbc5502461 100644 --- a/jenetics/src/main/java/io/jenetics/internal/util/Bits.java +++ b/jenetics/src/main/java/io/jenetics/internal/util/Bits.java @@ -153,7 +153,7 @@ public static byte[] unset(final byte[] data, final int index) { /** * Swap a given range with a range of the same size with another array. * - *{@code + * {@snippet lang="java": * start end * | | * data: +---+---+---+---+---+---+---+---+---+---+---+---+ @@ -162,7 +162,7 @@ public static byte[] unset(final byte[] data, final int index) { * otherData: +---+---+---+---+---+---+---+---+---+---+---+---+ * | * otherStart - * }+ * } * * @param data the first byte array which is used for swapping. * @param start the start bit index of the {@code data} byte array, @@ -459,13 +459,13 @@ public static boolean getAndSet(final byte[] array, final int index) { /** * Convert a binary representation of the given byte array to a string. The * string has the following format: - *{@code + * {@snippet lang="java": * Byte: 3 2 1 0 * | | | | * Array: "11110011|10011101|01000000|00101010" * | | | | * Bit: 23 15 7 0 - * }+ * } * Only the array string is printed. * * @see #fromByteString(String) diff --git a/jenetics/src/main/java/io/jenetics/internal/util/Lifecycle.java b/jenetics/src/main/java/io/jenetics/internal/util/Lifecycle.java index 22327828c4..99f9cf004f 100644 --- a/jenetics/src/main/java/io/jenetics/internal/util/Lifecycle.java +++ b/jenetics/src/main/java/io/jenetics/internal/util/Lifecycle.java @@ -36,7 +36,7 @@ * Interfaces and classes for handling resource ({@link AutoCloseable}) objects. * The common use cases are shown as follows: *Wrapping non-closeable values
- *{@code + * {@snippet lang="java": * final Value+ * } * *file = new Value<>( * Files.createFile(Path.of("some_file")), * Files::deleteIfExists @@ -48,10 +48,10 @@ * final var writtenText = Files.readString(file.get()); * assert "foo".equals(writtenText); * } - * } Building complex closeable values
- *{@code + * {@snippet lang="java": * final IOValue+ * } * *> result = new IOValue<>(resources -> { * final var fin = resources.add(new FileInputStream(file.toFile())); * final var bin = resources.add(new BufferedInputStream(fin)); @@ -64,14 +64,14 @@ * try (result) { * result.get().forEach(System.out::println); * } - * } Wrapping several closeables into one
- *{@code + * {@snippet lang="java": * try (var __ = ExtendedCloseable.of(c1, c2, c3)) { * ... * } - * }+ * } * * @author Franz Wilhelmstötter * @since 6.2 @@ -269,7 +269,7 @@ default void silentClose(final Throwable previousError) { * example the created {@code file} is automatically deleted when leaving the * {@code try} block. * - *{@code + * {@snippet lang="java": * // Create the closeable file. * final Value+ * } * * @paramfile = new Value<>( * Files.createFile(Path.of("some_file")), @@ -282,7 +282,7 @@ default void silentClose(final Throwable previousError) { * final var writtenText = Files.readString(file.get()); * assert "foo".equals(writtenText); * } - * } the value type */ @@ -321,7 +321,7 @@ public Value( * caller is responsible for closing the opened resources by * calling the {@link Value#close()} method. * - * {@code + * {@snippet lang="java": * final Value+ * } * * @see Resources * @@ -388,7 +388,7 @@ public String toString() { * use case for this method is when additional initialization of the * value is needed. * - *, IOException> result = new Value<>(resources -> { * final var fin = resources.add(new FileInputStream(file.toFile()), Closeable::close); * final var bin = resources.add(new BufferedInputStream(fin), Closeable::close); @@ -334,7 +334,7 @@ public Value( * try (result) { * result.get().forEach(System.out::println); * } - * } {@code + * {@snippet lang="java": * final var file = CloseableValue.of( * Files.createFile(Path.of("some_file")), * Files::deleteIfExists @@ -400,7 +400,7 @@ public String toString() { * try (file) { * // Do something with temp file. * } - * }+ * } * * @param block the codec block which is applied to the value * @param releases additional release methods, which are called in the @@ -433,7 +433,7 @@ public finalvoid trying( * example the created {@code file} is automatically deleted when leaving the * {@code try} block. * - * {@code + * {@snippet lang="java": * // Create the closeable file. * final IOValue+ * } * * @paramfile = new IOValue<>( * Files.createFile(Path.of("some_file")), @@ -446,7 +446,7 @@ public final void trying( * final var writtenText = Files.readString(file.get()); * assert "foo".equals(writtenText); * } - * } the value type */ @@ -479,7 +479,7 @@ public IOValue( * caller is responsible for closing the opened resources by * calling the {@link Value#close()} method. * - * {@code + * {@snippet lang="java": * final IOValue+ * } * * @see Resources * @@ -534,7 +534,7 @@ public> result = new IOValue<>(resources -> { * final var fin = resources.add(new FileInputStream(file.toFile())); * final var bin = resources.add(new BufferedInputStream(fin)); @@ -492,7 +492,7 @@ public IOValue( * try (result) { * result.get().forEach(System.out::println); * } - * } IOValue( * dependent input streams, where it might be otherwise necessary to create * nested {@code try-with-resources} blocks. * - * {@code + * {@snippet lang="java": * try (var resources = new Resources+ * } */ public static sealed class Resources()) { * final var fin = resources.add(new FileInputStream(file), Closeable::close); * if (fin.read() != -1) { @@ -543,7 +543,7 @@ public IOValue( * final var oin = resources.add(new ObjectInputStream(fin), Closeable::close); * // ... * } - * } implements ExtendedCloseable @@ -634,7 +634,7 @@ public void close() throws E { * dependent input streams, where it might be otherwise necessary to create * nested {@code try-with-resources} blocks. * - * {@code + * {@snippet lang="java": * try (var resources = new IOResources()) { * final var fin = resources.add(new FileInputStream(file)); * if (fin.read() != -1) { @@ -643,7 +643,7 @@ public void close() throws E { * final var oin = resources.add(new ObjectInputStream(fin)); * // ... * } - * }+ * } */ public static final class IOResources extends Resources{ @@ -707,14 +707,14 @@ private Lifecycle() { * is rethrown after invoking the method on the remaining objects, all other * exceptions are swallowed. * - * {@code + * {@snippet lang="java": * final var streams = new ArrayList+ * } * * @param the closeable object type * @param(); * streams.add(new FileInputStream(file1)); * streams.add(new FileInputStream(file2)); * streams.add(new FileInputStream(file3)); * // ... * invokeAll(Closeable::close, streams); - * } the exception type diff --git a/jenetics/src/main/java/io/jenetics/package-info.java b/jenetics/src/main/java/io/jenetics/package-info.java index 31a15d8ffc..407f2853e0 100644 --- a/jenetics/src/main/java/io/jenetics/package-info.java +++ b/jenetics/src/main/java/io/jenetics/package-info.java @@ -43,7 +43,7 @@ * implements the Factory interface and can therefore be used as prototype for * creating the initial Population and for creating new random Genotypes. * - * {@code + * {@snippet lang="java": * import io.jenetics.BitChromosome; * import io.jenetics.BitGene; * import io.jenetics.Genotype; @@ -77,7 +77,7 @@ * System.out.println("Hello World:\n" + result); * } * } - * }+ * } * *In contrast to other GA implementations, the library uses the concept of * an evolution stream (EvolutionStream) for executing the evolution steps. diff --git a/jenetics/src/main/java/io/jenetics/stat/DoubleMomentStatistics.java b/jenetics/src/main/java/io/jenetics/stat/DoubleMomentStatistics.java index dc60a6b623..c7e5df9e5a 100644 --- a/jenetics/src/main/java/io/jenetics/stat/DoubleMomentStatistics.java +++ b/jenetics/src/main/java/io/jenetics/stat/DoubleMomentStatistics.java @@ -34,21 +34,21 @@ *
* This class is designed to work with (though does not require) streams. For * example, you can compute moments-statistics on a stream of doubles with: - *
{@code + * {@snippet lang="java": * final DoubleStream stream = ... * final DoubleMomentStatistics statistics = stream.collect( * DoubleMomentStatistics::new, * DoubleMomentStatistics::accept, * DoubleMomentStatistics::combine * ); - * }+ * } * * For a non-double stream, you can use a collector: - *{@code + * {@snippet lang="java": * final Stream+ * } * * @implNote * This implementation is not thread safe. However, it is safe to use @@ -149,7 +149,7 @@ public double sum() { * a replacement for the {@link #equals(Object)} which is not advisable to * implement for this mutable object. If two objects have the same state, it * has still the same state when updated with the same value. - *stream = ... * final DoubleMomentStatistics statistics = stream * .collect(toDoubleMomentStatistics(v -> v.doubleValue())); - * } {@code + * {@snippet lang="java": * final DoubleMomentStatistics ds1 = ...; * final DoubleMomentStatistics ds2 = ...; * @@ -162,7 +162,7 @@ public double sum() { * assert ds2.sameState(ds1); * assert ds1.sameState(ds1); * } - * }+ * } * * @since 3.7 * @@ -207,11 +207,11 @@ public String toString() { * function to each input element, and returns moments-statistics for the * resulting values. * - *{@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final DoubleMomentStatistics statistics = stream * .collect(toDoubleMomentStatistics(v -> v.doubleValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/DoubleMoments.java b/jenetics/src/main/java/io/jenetics/stat/DoubleMoments.java index 21b41b83d7..80bee7b954 100644 --- a/jenetics/src/main/java/io/jenetics/stat/DoubleMoments.java +++ b/jenetics/src/main/java/io/jenetics/stat/DoubleMoments.java @@ -102,10 +102,10 @@ public static DoubleMoments of(final DoubleMomentStatistics statistics) { * Return a {@code Collector} which returns moments-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @since 4.1 * @@ -122,11 +122,11 @@ public static DoubleMoments of(final DoubleMomentStatistics statistics) { * function to each input element, and returns moments-statistics for the * resulting values. * - *stream = ... * final DoubleMoments moments = stream.collect(toDoubleMoments())); - * } {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final DoubleMoments moments = stream * .collect(toDoubleMoments(v -> v.doubleValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/DoubleSummary.java b/jenetics/src/main/java/io/jenetics/stat/DoubleSummary.java index e2053cd9b2..e29960d50a 100644 --- a/jenetics/src/main/java/io/jenetics/stat/DoubleSummary.java +++ b/jenetics/src/main/java/io/jenetics/stat/DoubleSummary.java @@ -90,11 +90,11 @@ public static DoubleSummary of(final DoubleSummaryStatistics statistics) { * function to each input element, and return summary-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final DoubleSummary summary = stream * .collect(toDoubleSummary(v -> v.doubleValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/IntMomentStatistics.java b/jenetics/src/main/java/io/jenetics/stat/IntMomentStatistics.java index fa3214a6fb..091b807661 100644 --- a/jenetics/src/main/java/io/jenetics/stat/IntMomentStatistics.java +++ b/jenetics/src/main/java/io/jenetics/stat/IntMomentStatistics.java @@ -32,21 +32,21 @@ * * This class is designed to work with (though does not require) streams. For * example, you can compute moments-statistics on a stream of ints with: - *
{@code + * {@snippet lang="java": * final IntStream stream = ... * final IntMomentStatistics statistics = stream.collect( * IntMomentStatistics::new, * IntMomentStatistics::accept, * IntMomentStatistics::combine * ); - * }+ * } * * For a non int stream, you can use a collector: - *{@code + * {@snippet lang="java": * final Stream+ * } * * @implNote * This implementation is not thread safe. However, it is safe to use @@ -146,7 +146,7 @@ public long sum() { * a replacement for the {@link #equals(Object)} which is not advisable to * implement for this mutable object. If two objects have the same state, it * has still the same state when updated with the same value. - *stream = ... * final IntMomentStatistics statistics = stream * .collect(toIntMomentStatistics(v -> v.intValue())); - * } {@code + * {@snippet lang="java": * final IntMomentStatistics ims1 = ...; * final IntMomentStatistics ims2 = ...; * @@ -159,7 +159,7 @@ public long sum() { * assert ims2.sameState(ims1); * assert ims1.sameState(ims1); * } - * }+ * } * * @since 3.7 * @@ -200,11 +200,11 @@ public String toString() { * function to each input element, and returns moments-statistics for the * resulting values. * - *{@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final IntMomentStatistics statistics = stream * .collect(toIntMomentStatistics(v -> v.intValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/IntMoments.java b/jenetics/src/main/java/io/jenetics/stat/IntMoments.java index 1dea33927c..774c8ef854 100644 --- a/jenetics/src/main/java/io/jenetics/stat/IntMoments.java +++ b/jenetics/src/main/java/io/jenetics/stat/IntMoments.java @@ -101,10 +101,10 @@ public static IntMoments of(final IntMomentStatistics statistics) { * Return a {@code Collector} which returns moments-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @since 4.1 * @@ -121,11 +121,11 @@ public static IntMoments of(final IntMomentStatistics statistics) { * function to each input element, and returns moments-statistics for the * resulting values. * - *stream = ... * final IntMoments moments = stream.collect(toIntMoments())); - * } {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final IntMoments moments = stream * .collect(toIntMoments(v -> v.intValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/IntSummary.java b/jenetics/src/main/java/io/jenetics/stat/IntSummary.java index d3958f7bbc..de27571b41 100644 --- a/jenetics/src/main/java/io/jenetics/stat/IntSummary.java +++ b/jenetics/src/main/java/io/jenetics/stat/IntSummary.java @@ -89,11 +89,11 @@ public static IntSummary of(final IntSummaryStatistics statistics) { * function to each input element, and return summary-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final IntSummary summary = stream * .collect(toIntSummary(v -> v.intValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/LongMomentStatistics.java b/jenetics/src/main/java/io/jenetics/stat/LongMomentStatistics.java index 1d0a18af87..8bfc344eba 100644 --- a/jenetics/src/main/java/io/jenetics/stat/LongMomentStatistics.java +++ b/jenetics/src/main/java/io/jenetics/stat/LongMomentStatistics.java @@ -33,21 +33,21 @@ * * This class is designed to work with (though does not require) streams. For * example, you can compute moments-statistics on a stream of longs with: - *
{@code + * {@snippet lang="java": * final LongStream stream = ... * final LongMomentStatistics statistics = stream.collect( * LongMomentStatistics::new, * LongMomentStatistics::accept, * LongMomentStatistics::combine * ); - * }+ * } * * For a non-long stream, you can use a collector: - *{@code + * {@snippet lang="java": * final Stream+ * } * * @implNote * This implementation is not thread safe. However, it is safe to use @@ -156,7 +156,7 @@ public long sum() { * a replacement for the {@link #equals(Object)} which is not advisable to * implement for this mutable object. If two objects have the same state, it * has still the same state when updated with the same value. - *stream = ... * final LongMomentStatistics statistics = stream * .collect(toLongMomentStatistics(v -> v.longValue())); - * } {@code + * {@snippet lang="java": * final LongMomentStatistics lms1 = ...; * final LongMomentStatistics lms2 = ...; * @@ -169,7 +169,7 @@ public long sum() { * assert lms2.sameState(lms1); * assert lms1.sameState(lms1); * } - * }+ * } * * @since 3.7 * @@ -210,11 +210,11 @@ public String toString() { * function to each input element, and returns moments-statistics for the * resulting values. * - *{@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final LongMomentStatistics statistics = stream * .collect(toLongMomentStatistics(v -> v.longValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/LongMoments.java b/jenetics/src/main/java/io/jenetics/stat/LongMoments.java index 5f38bcd75d..5544447de7 100644 --- a/jenetics/src/main/java/io/jenetics/stat/LongMoments.java +++ b/jenetics/src/main/java/io/jenetics/stat/LongMoments.java @@ -101,10 +101,10 @@ public static LongMoments of(final LongMomentStatistics statistics) { * Return a {@code Collector} which returns moments-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @since 4.1 * @@ -121,11 +121,11 @@ public static LongMoments of(final LongMomentStatistics statistics) { * function to each input element, and returns moments-statistics for the * resulting values. * - *stream = ... * final LongMoments moments = stream.collect(toLongMoments())); - * } {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final LongMoments moments = stream * .collect(toLongMoments(v -> v.longValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/LongSummary.java b/jenetics/src/main/java/io/jenetics/stat/LongSummary.java index 450057a7fb..e86a73fab0 100644 --- a/jenetics/src/main/java/io/jenetics/stat/LongSummary.java +++ b/jenetics/src/main/java/io/jenetics/stat/LongSummary.java @@ -89,11 +89,11 @@ public static LongSummary of(final LongSummaryStatistics statistics) { * function to each input element, and return summary-statistics for the * resulting values. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final LongSummary summary = stream * .collect(toLongSummary(v -> v.longValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/stat/MinMax.java b/jenetics/src/main/java/io/jenetics/stat/MinMax.java index 949042eddb..18cc2693ff 100644 --- a/jenetics/src/main/java/io/jenetics/stat/MinMax.java +++ b/jenetics/src/main/java/io/jenetics/stat/MinMax.java @@ -37,14 +37,14 @@ * * This class is designed to work with (though does not require) streams. For * example, you can compute minimum and maximum values with: - *
{@code + * {@snippet lang="java": * final Stream+ * } * * @implNote * This implementation is not thread safe. However, it is safe to use on a @@ -131,7 +131,7 @@ public C max() { * a replacement for the {@link #equals(Object)} which is not advisable to * implement for this mutable object. If two objects have the same state, it * has still the same state when updated with the same value. - *stream = ... * final MinMax minMax = stream.collect( * MinMax::of, * MinMax::accept, * MinMax::combine * ); - * } {@code + * {@snippet lang="java": * final MinMax mm1 = ...; * final MinMax mm2 = ...; * @@ -144,7 +144,7 @@ public C max() { * assert mm2.sameState(mm1); * assert mm1.sameState(mm1); * } - * }+ * } * * @since 3.7 * @@ -210,12 +210,12 @@ public String toString() { * Return a {@code Collector} which calculates the minimum and maximum value. * The given {@code comparator} is used for comparing two objects. * - *{@code + * {@snippet lang="java": * final Comparator+ * } * * @param comparator the {@code Comparator} to use * @paramcomparator = ... * final Stream stream = ... * final MinMax moments = stream * .collect(doubleMoments.toMinMax(comparator)); - * } the type of the input elements @@ -237,11 +237,11 @@ public String toString() { * Return a {@code Collector} which calculates the minimum and maximum value. * The reducing objects must be comparable. * - * {@code + * {@snippet lang="java": * final Stream+ * } * * @paramstream = ... * final MinMax moments = stream * .collect(doubleMoments.toMinMax(comparator)); - * } the type of the input elements * @return a {@code Collector} implementing the min-max reduction @@ -288,7 +288,7 @@ public static > MinMax of() { * function doesn't sort the stream. It just skips the out of * order elements. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * @since 5.0 * @@ -315,7 +315,7 @@ Functionvalues = new Random().ints(0, 100) * .boxed() * .limit(100) @@ -297,7 +297,7 @@ public static > MinMax of() { * * System.out.println(values); * // [6,47,65,78,96,96,99] - * } > toStrictlyIncreasing() { * function doesn't sort the stream. It just skips the out of * order elements. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * @since 5.0 * @@ -342,7 +342,7 @@ Functionvalues = new Random().ints(0, 100) * .boxed() * .limit(100) @@ -324,7 +324,7 @@ Function > toStrictlyIncreasing() { * * System.out.println(values); * // [45,32,15,12,3,1] - * } > toStrictlyDecreasing() { * function doesn't sort the stream. It just skips the out of * order elements. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * @since 6.0 * diff --git a/jenetics/src/main/java/io/jenetics/stat/Quantile.java b/jenetics/src/main/java/io/jenetics/stat/Quantile.java index 9574f9a385..34baa86567 100644 --- a/jenetics/src/main/java/io/jenetics/stat/Quantile.java +++ b/jenetics/src/main/java/io/jenetics/stat/Quantile.java @@ -43,14 +43,14 @@ *values = new Random().ints(0, 100) * .boxed() * .limit(100) @@ -351,7 +351,7 @@ Function > toStrictlyDecreasing() { * * System.out.println(values); * // [6,47,65,78,96,96,99] - * } * This class is designed to work with (though does not require) streams. For * example, you can compute the quantile with: - *
{@code + * {@snippet lang="java": * final DoubleStream stream = ... * final Quantile quantile = stream.collect( * () -> new Quantile(0.23), * Quantile::accept, * Quantile::combine * ); - * }+ * } * * @implNote * This implementation is not thread safe. However, it is safe to use on a @@ -378,7 +378,7 @@ private static double qMinus( * a replacement for the {@link #equals(Object)} which is not advisable to * implement for this mutable object. If two objects have the same state, it * has still the same state when updated with the same value. - *{@code + * {@snippet lang="java": * final Quantile q1 = ...; * final Quantile q2 = ...; * @@ -391,7 +391,7 @@ private static double qMinus( * assert q2.sameState(q1); * assert q1.sameState(q1); * } - * }+ * } * * @since 3.7 * @@ -425,11 +425,11 @@ static Quantile median() { * function to each input element, and returns quantiles for the resulting * values. * - *{@code + * {@snippet lang="java": * final Stream+ * } * * @param quantile the wished quantile value. * @param mapper a mapping function to apply to each element @@ -459,10 +459,10 @@ static Quantile median() { * function to each input element, and returns the median for the resulting * values. * - *stream = ... * final Quantile quantile = stream * .collect(toQuantile(0.25, v -> v.doubleValue())); - * } {@code + * {@snippet lang="java": * final Stream+ * } * * @param mapper a mapping function to apply to each element * @paramstream = ... * final Quantile median = stream.collect(toMedian(v -> v.doubleValue())); - * } the type of the input elements diff --git a/jenetics/src/main/java/io/jenetics/util/Accumulator.java b/jenetics/src/main/java/io/jenetics/util/Accumulator.java index 383aa16517..cd6042b5b8 100644 --- a/jenetics/src/main/java/io/jenetics/util/Accumulator.java +++ b/jenetics/src/main/java/io/jenetics/util/Accumulator.java @@ -34,7 +34,7 @@ * can deliver intermediate results while accumulating. An accumulator can be * created from any {@link Collector} with the ({@link #of(Collector)}) method. * - * {@code + * {@snippet lang="java": * final Accumulator+ * } * The code above gives you the following output. *> accu = * Accumulator.of(Collectors.toList()); * @@ -44,7 +44,7 @@ * .collect(ISeq.toISeq()); * * result.forEach(System.out::println); - * } * [0] @@ -156,10 +156,10 @@ default Setcharacteristics() { /** * Create a new accumulator from the given {@code collector}. * - * {@code + * {@snippet lang="java": * final Accumulator+ * } * * @param collector the collector which is used for accumulation and creation * the result value. diff --git a/jenetics/src/main/java/io/jenetics/util/CharSeq.java b/jenetics/src/main/java/io/jenetics/util/CharSeq.java index 23e44c41e8..f220d2ef6f 100644 --- a/jenetics/src/main/java/io/jenetics/util/CharSeq.java +++ b/jenetics/src/main/java/io/jenetics/util/CharSeq.java @@ -37,11 +37,11 @@ * classical sense. The characters of this sequence are sorted and doesn't * contain duplicate values, like a set. * - *> accu = * Accumulator.of(ISeq.toISeq()); - * } {@code + * {@snippet lang="java": * final CharSeq cs1 = new CharSeq("abcdeaafg"); * final CharSeq cs2 = new CharSeq("gfedcbabb"); * assert(cs1.equals(cs2)); - * }+ * } * * @author Franz Wilhelmstötter * @since 1.0 diff --git a/jenetics/src/main/java/io/jenetics/util/IO.java b/jenetics/src/main/java/io/jenetics/util/IO.java index 4c18243fa2..4bdd5dff2e 100644 --- a/jenetics/src/main/java/io/jenetics/util/IO.java +++ b/jenetics/src/main/java/io/jenetics/util/IO.java @@ -35,7 +35,7 @@ * Class for object serialization. The following example shows how to write and * reload a given population. * - *{@code + * {@snippet lang="java": * // Creating result population. * EvolutionResult+ * } * * @author Franz Wilhelmstötter * @since 1.0 diff --git a/jenetics/src/main/java/io/jenetics/util/ISeq.java b/jenetics/src/main/java/io/jenetics/util/ISeq.java index a617b11097..1ff31510d8 100644 --- a/jenetics/src/main/java/io/jenetics/util/ISeq.java +++ b/jenetics/src/main/java/io/jenetics/util/ISeq.java @@ -273,7 +273,7 @@ staticresult = stream * .collect(toBestEvolutionResult()); @@ -49,7 +49,7 @@ * EvolutionStream stream = Engine * .build(ff, gtf) * .stream(population, 1); - * } ISeq of( * {@code A}. Since {@code ISeq} instances are immutable, an upcast * will be always safe. * - * {@code + * {@snippet lang="java": * // The sequence which we want to case. * final ISeq extends Number> ints = ISeq.of(1, 2, 3, 4, 5); * @@ -284,7 +284,7 @@ static+ * } * * @since 3.6 * diff --git a/jenetics/src/main/java/io/jenetics/util/IntRange.java b/jenetics/src/main/java/io/jenetics/util/IntRange.java index 6fa5d73141..fc49b131ac 100644 --- a/jenetics/src/main/java/io/jenetics/util/IntRange.java +++ b/jenetics/src/main/java/io/jenetics/util/IntRange.java @@ -98,11 +98,11 @@ public int size() { *ISeq of( * // This cast will, of course, still fail. * final ISeq strings = ISeq.upcast(ints); * final ISeq integers = ISeq.upcast(ints); - * } * An equivalent sequence of increasing values can be produced sequentially * using a {@code for} loop as follows: - *
{@code + * {@snippet lang="java": * for (int i = range.min(); i < range.max(); ++i) { * ... * } - * }+ * } * * @since 3.4 * diff --git a/jenetics/src/main/java/io/jenetics/util/LongRange.java b/jenetics/src/main/java/io/jenetics/util/LongRange.java index 5b72152344..bb37a5a770 100644 --- a/jenetics/src/main/java/io/jenetics/util/LongRange.java +++ b/jenetics/src/main/java/io/jenetics/util/LongRange.java @@ -87,11 +87,11 @@ public long max() { ** An equivalent sequence of increasing values can be produced sequentially * using a {@code for} loop as follows: - *
{@code + * {@snippet lang="java": * for (long i = range.min(); i < range.max(); ++i) { * ... * } - * }+ * } * * @since 3.4 * diff --git a/jenetics/src/main/java/io/jenetics/util/PartitionBatchExecutor.java b/jenetics/src/main/java/io/jenetics/util/PartitionBatchExecutor.java index cdb298a465..e71ec76469 100644 --- a/jenetics/src/main/java/io/jenetics/util/PartitionBatchExecutor.java +++ b/jenetics/src/main/java/io/jenetics/util/PartitionBatchExecutor.java @@ -92,12 +92,12 @@ private void execute(final Runnable command, final List> futures) { * * The following examples print the start index (inclusive) and the end * index (exclusive) of the {@code partition(15, 6)}. - * {@code + * {@snippet lang="java": * int[] parts = partition(15, 6); * for (int i = 0; i < parts.length - 1; ++i) { * System.out.println(i + ": " + parts[i] + "\t" + parts[i + 1]); * } - * }+ * } ** 0: 0 2 * 1: 2 4 @@ -108,7 +108,7 @@ private void execute(final Runnable command, final List* * This example shows how this can be used in an concurrent environment: - *> futures) { * {@code + * {@snippet lang="java": * try (final Concurrency c = Concurrency.start()) { * final int[] parts = arrays.partition(population.size(), _maxThreads); * @@ -121,7 +121,7 @@ private void execute(final Runnable command, final List+ * } * * @param size the size of the array to partition. * @param parts the number of parts the (virtual) array should be partitioned. diff --git a/jenetics/src/main/java/io/jenetics/util/ProxySorter.java b/jenetics/src/main/java/io/jenetics/util/ProxySorter.java index bb9e5b3f92..9ba4f34cf9 100644 --- a/jenetics/src/main/java/io/jenetics/util/ProxySorter.java +++ b/jenetics/src/main/java/io/jenetics/util/ProxySorter.java @@ -28,7 +28,7 @@ * an index lookup array is returned which allows to access the array in a * sorted order. * - *> futures) { * }}); * } * } - * } {@code + * {@snippet lang="java": * final double[] array = new Random().doubles(100).toArray(); * final int[] proxy = ProxySorter.sort(array); * @@ -40,18 +40,18 @@ * for (int i = 0; i < array.length; ++i) { * assert sorted[i] == array[proxy[i]]; * } - * }+ * } * * The minimal requirement of the proxy-sorter will be an access function and * the number of elements you want to sort. - *{@code + * {@snippet lang="java": * final IntFunction+ * } * @apiNote * The most general sorting method is {@link #sort(Object, int, Comparator)}. * All other sorting methods can be created with this method. @@ -68,10 +68,10 @@ public final class ProxySorter { /** * The comparator used for comparing two array elements at the specified * indexes. - *access = ...; * final int length = 100; * final int[] proxy = ProxySorter.sort( * access, length, * (a, i, j) -> a.apply(i).compareTo(a.apply(j)) * ); - * } {@code + * {@snippet lang="java": * final ProxySorter.Comparator+ * } * The example above shows how to create a comparator for {@code double[]} * arrays. * @@ -144,7 +144,7 @@ private ProxySorter() { * array is not touched, and the returned array can then be used for * iterating the array in ascending order. * - *comparator = * (a, i, j) -> Double.compare(a[i], a[j]); - * } {@code + * {@snippet lang="java": * final double[] array = ...; * final int[] sorted = ProxySorter.sort( * array, 5, array.length, @@ -153,7 +153,7 @@ private ProxySorter() { * for (int i : sorted) { * System.out.println(array[i]); * } - * }+ * } * * @since 6.3 * @@ -182,7 +182,7 @@ public staticint[] sort( * array is not touched, and the returned array can then be used for * iterating the array in ascending order. * - * {@code + * {@snippet lang="java": * final double[] array = ...; * final int[] sorted = ProxySorter.sort( * array, array.length, @@ -191,7 +191,7 @@ public static+ * } * * @param array the array which is sorted * @param length the array length diff --git a/jenetics/src/main/java/io/jenetics/util/RandomAdapter.java b/jenetics/src/main/java/io/jenetics/util/RandomAdapter.java index 63ca882408..f8226888c7 100644 --- a/jenetics/src/main/java/io/jenetics/util/RandomAdapter.java +++ b/jenetics/src/main/java/io/jenetics/util/RandomAdapter.java @@ -32,10 +32,10 @@ * Some places in the Java API still require a {@link Random} object instead of * the new {@link RandomGenerator}. This class can be used by using this adapter * class. - *int[] sort( * for (int i : sorted) { * System.out.println(array[i]); * } - * } {@code + * {@snippet lang="java": * final var random = RandomGenerator.getDefault(); * final var bi = new BigInteger(100, RandomAdapter.of(random)); - * }+ * } * * @author Franz Wilhelmstötter * @since 7.0 diff --git a/jenetics/src/main/java/io/jenetics/util/RandomRegistry.java b/jenetics/src/main/java/io/jenetics/util/RandomRegistry.java index c0c68df272..a2adc6dd10 100644 --- a/jenetics/src/main/java/io/jenetics/util/RandomRegistry.java +++ b/jenetics/src/main/java/io/jenetics/util/RandomRegistry.java @@ -43,13 +43,13 @@ * generator. By using a factory, each thread gets its own generator instance, * which ensures thread-safety without the necessity of the created random * generator to be thread-safe. - *{@code + * {@snippet lang="java": * // This is the default setup. * RandomRegistry.random(RandomGeneratorFactory.getDefault()); * * // Using the "L128X1024MixRandom" random generator for the evolution. * RandomRegistry.random(RandomGeneratorFactory.of("L128X1024MixRandom")); - * }+ * } *
* * Using a {@link RandomGenerator} {@link Supplier}
@@ -57,35 +57,35 @@ * {@link RandomGeneratorFactory}, it is also possible to register a * {@link Supplier} of the desired random generator. This method has the same * thread-safety property as the method above. - *{@code + * {@snippet lang="java": * RandomRegistry.random(() -> new MySpecialRandomGenerator()); - * }+ * } * * Register a random generator supplier is also more flexible. It allows * using the streaming and splitting capabilities of the random generators * implemented in the Java library. - *{@code + * {@snippet lang="java": * final Iterator+ * } *randoms = * StreamableGenerator.of("L128X1024MixRandom") * .rngs() * .iterator(); * * RandomRegistry.random(randoms::next); - * }
* * Using a {@link RandomGenerator} instance
* It is also possible to set a single random generator instance for the whole * evolution process. When using this setup, the used random generator must be * thread safe. - *{@code + * {@snippet lang="java": * RandomRegistry.random(new Random(123456)); - * }+ * } ** * The following code snippet shows an almost complete example of a typical * random generator setup. - *
{@code + * {@snippet lang="java": * public class GA { * public static void main(final String[] args) { * // Initialize the registry with the factory of the PRGN. @@ -98,14 +98,14 @@ * .collect(toBestEvolutionResult()); * } * } - * }+ * } * *Setup of a local PRNG
* * You can temporarily (and locally) change the implementation of the PRNG. E.g., * for initialize the engine stream with the same initial population. * - *{@code + * {@snippet lang="java": * public class GA { * public static void main(final String[] args) { * // Create a reproducible list of genotypes. @@ -125,18 +125,18 @@ * .collect(toBestEvolutionResult()); * } * } - * }+ * } * ** The default random generator used by Jenetics is * {@code L64X256MixRandom}. Via the system property * {@code io.jenetics.util.defaultRandomGenerator}, it is possible to use a * different random generator. - *
{@code + * {@snippet lang="java": * java -Dio.jenetics.util.defaultRandomGenerator=L64X1024MixRandom\ * -cp jenetics-@__version__@.jar:app.jar\ * com.foo.bar.MyJeneticsApp - * }+ * } * * @see RandomGenerator * @see RandomGeneratorFactory @@ -235,12 +235,12 @@ public static void reset() { /** * Executes the consumer code using the given {@code random} generator. * - *{@code + * {@snippet lang="java": * final MSeq+ * } * * The example above shuffles the given integer {@code seq} using the * given {@code Random(123)} engine. @@ -266,12 +266,12 @@ public staticseq = ... * using(new Random(123), r -> { * seq.shuffle(); * }); - * } void using( /** * Executes the consumer code using the given {@code random} generator. * - * {@code + * {@snippet lang="java": * final MSeq+ * } * * The example above shuffles the given integer {@code seq} using the * given {@link RandomGeneratorFactory#getDefault()} factory. @@ -298,12 +298,12 @@ public staticseq = ... * using(RandomGeneratorFactory.getDefault(), r -> { * seq.shuffle(); * }); - * } void using( * Executes the consumer code using the given {@code random} generator * supplier. * - * {@code + * {@snippet lang="java": * final MSeq+ * } * * @since 7.0 * @@ -327,14 +327,14 @@ public staticseq = ... * using(() -> new MyRandomGenerator(), r -> { * seq.shuffle(); * }); - * } void using( * Opens a new scope with the given random generator and executes * the given function within it. The following example shows how to create a * reproducible list of genotypes: - * {@code + * {@snippet lang="java": * final List+ * } * * @since 3.0 * @@ -358,14 +358,14 @@ public static> genotypes = * with(new LCG64ShiftRandom(123), r -> * Genotype.of(DoubleChromosome.of(0, 10)).instances() * .limit(50) * .collect(toList()) * ); - * } T with( /** * Opens a new scope with the given random generator factory and * executes the given function within it. - * {@code + * {@snippet lang="java": * final List+ * } * * @since 3.0 * @@ -388,14 +388,14 @@ public static> genotypes = * with(RandomGeneratorFactory.getDefault(), random -> * Genotype.of(DoubleChromosome.of(0, 10)).instances() * .limit(50) * .collect(toList()) * ); - * } T with( /** * Opens a new scope with the given random generator supplier and * executes the given function within it. - * {@code + * {@snippet lang="java": * final List+ * } * * @since 3.0 * diff --git a/jenetics/src/main/java/io/jenetics/util/Self.java b/jenetics/src/main/java/io/jenetics/util/Self.java index b32c7146b7..8bb0af6bb2 100644 --- a/jenetics/src/main/java/io/jenetics/util/Self.java +++ b/jenetics/src/main/java/io/jenetics/util/Self.java @@ -22,18 +22,18 @@ /** * This interface defines a recursive generic type {@code S}, which * represents the type of the implementing class. - *> genotypes = * with(() -> new MyRandomGenerator(), random -> * Genotype.of(DoubleChromosome.of(0, 10)).instances() * .limit(50) * .collect(toList()) * ); - * } {@code + * {@snippet lang="java": * interface Foo+ * } * Using the {@code Self} interface in this case makes it clear that the generic * type {@code T} of the interface {@code Foo} represents the concrete type of * the class, implementing the interface {@code Foo}. *> extends Self { * // ... * } - * } * If the interface is used as intended, the following generic {@code min} method * can be implemented as a default method. - *
{@code + * {@snippet lang="java": * interface Foo> extends Self, Comparable { * // ... * @@ -41,7 +41,7 @@ * return compareTo(other) > 0 ? self() : other; * } * } - * }+ * } * * @paramthe type of the implementing class. * diff --git a/jenetics/src/main/java/io/jenetics/util/Seq.java b/jenetics/src/main/java/io/jenetics/util/Seq.java index c66398b28f..874b0c8227 100644 --- a/jenetics/src/main/java/io/jenetics/util/Seq.java +++ b/jenetics/src/main/java/io/jenetics/util/Seq.java @@ -169,13 +169,13 @@ default int indexOf(final Object element, final int start, final int end) { * returns {@code true}, or -1 if the predicate returns false for every * sequence element. * - *{@code + * {@snippet lang="java": * // Finding index of first null value. * final int index = seq.indexOf(o -> o == null); * * // Assert of no null values. * assert (sequence.indexOf(o -> o == null) == -1); - * }+ * } * * @param predicate the search predicate. * @return the index of the first element on which the given predicate @@ -193,13 +193,13 @@ default int indexWhere(final Predicate super T> predicate) { * returns {@code true}, or -1 if the predicate returns false for every * sequence element. * - *{@code + * {@snippet lang="java": * // Finding index of first null value. * final int index = seq.indexOf(o -> o == null); * * // Assert of no null values. * assert (sequence.indexOf(o -> o == null) == -1); - * }+ * } * * @param predicate the search predicate. * @param start the search start index @@ -223,13 +223,13 @@ default int indexWhere( * returns {@code true}, or -1 if the predicate returns false for every * sequence element. * - *{@code + * {@snippet lang="java": * // Finding index of first null value. * final int index = seq.indexOf(o -> o == null); * * // Assert of no null values. * assert (sequence.indexOf(o -> o == null) == -1); - * }+ * } * * @param predicate the search predicate. * @param start the search start index @@ -650,14 +650,14 @@ default ISeqasISeq() { * Returns the hash code value for this sequence. The hash code is defined * as followed: * - * {@code + * {@snippet lang="java": * int hashCode = 1; * final Iterator+ * } * * @see List#hashCode() * @see Seq#hashCode(BaseSeq) @@ -718,14 +718,14 @@ default String toString(final String separator) { * Unified method for calculating the hash code of every {@link Seq} * implementation. The hash code is defined as followed: * - *it = seq.iterator(); * while (it.hasNext()) { * final E obj = it.next(); * hashCode = 31*hashCode + (obj == null ? 0 : obj.hashCode()); * } - * } {@code + * {@snippet lang="java": * int hashCode = 1; * final Iterator+ * } * * @see Seq#hashCode() * @see List#hashCode() diff --git a/jenetics/src/main/java/io/jenetics/util/StreamPublisher.java b/jenetics/src/main/java/io/jenetics/util/StreamPublisher.java index ed22491c9a..147427ea82 100644 --- a/jenetics/src/main/java/io/jenetics/util/StreamPublisher.java +++ b/jenetics/src/main/java/io/jenetics/util/StreamPublisher.java @@ -36,7 +36,7 @@ * This class allows creating a reactive {@link Flow.Publisher} from a given * Java {@link Stream}. * - *it = seq.iterator(); * while (it.hasNext()) { * final E obj = it.next(); * hashCode = 31*hashCode + (obj == null ? 0 : obj.hashCode()); * } - * } {@code + * {@snippet lang="java": * final Stream+ * } * * @paramstream = engine.stream() * .limit(33) * .map(EvolutionResult::generation); @@ -67,7 +67,7 @@ * * ... * } - * } the element type of the publisher * diff --git a/jenetics/src/main/java/io/jenetics/util/Streams.java b/jenetics/src/main/java/io/jenetics/util/Streams.java index 2e025752ea..4687dcd3d4 100644 --- a/jenetics/src/main/java/io/jenetics/util/Streams.java +++ b/jenetics/src/main/java/io/jenetics/util/Streams.java @@ -33,12 +33,12 @@ * This class contains factory methods for (flat) mapping stream elements. The * functions of this class can be used in the following way. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * @author Franz Wilhelmstötter * @since 6.0 @@ -54,13 +54,13 @@ private Streams() {} * function doesn't sort the stream. It just skips the out of * order elements. * - *values = new Random().ints(0, 100).boxed() * .limit(100) * .flatMap(Streams.toIntervalMax(13)) * .collect(ISeq.toISeq()); - * } {@code + * {@snippet lang="java": * +----3--2--5--4--7--7--4--9----| * toStrictlyIncreasing() * +----3-----5-----7--------9----| - * }+ * } * - *{@code + * {@snippet lang="java": * final ISeq+ * } * * * @paramvalues = new Random().ints(0, 100) * .boxed() * .limit(100) @@ -69,7 +69,7 @@ private Streams() {} * * System.out.println(values); * // [6,47,65,78,96,96,99] - * } the comparable type @@ -86,13 +86,13 @@ Function > toStrictlyIncreasing() { * function doesn't sort the stream. It just skips the out of * order elements. * - * {@code + * {@snippet lang="java": * +----9--8--9--5--6--6--2--9----| * toStrictlyDecreasing() * +----9--8-----5--------2-------| - * }+ * } * - *{@code + * {@snippet lang="java": * final ISeq+ * } * * @paramvalues = new Random().ints(0, 100) * .boxed() * .limit(100) @@ -101,7 +101,7 @@ Function > toStrictlyIncreasing() { * * System.out.println(values); * // [45,32,15,12,3,1] - * } the comparable type * @return a new flat-mapper function @@ -117,7 +117,7 @@ Function > toStrictlyDecreasing() { * function doesn't sort the stream. It just skips the out of * order elements. * - * {@code + * {@snippet lang="java": * final ISeq+ * } * * @see #toStrictlyIncreasing() * @see #toStrictlyDecreasing() @@ -182,13 +182,13 @@ T best(final Comparator super T> comparator, final T a, final T b) { * Return a new flat-mapper function which returns (emits) the maximal value * of the last n elements. * - *values = new Random().ints(0, 100) * .boxed() * .limit(100) @@ -126,7 +126,7 @@ Function > toStrictlyDecreasing() { * * System.out.println(values); * // [6,47,65,78,96,96,99] - * } {@code + * {@snippet lang="java": * +----3---+----3---+ * | | | * +----9--8--3--3--5--4--2--9----| * toIntervalMax(3) * +----------9--------5----------| - * }+ * } * * @param size the size of the slice * @paramthe element type @@ -204,13 +204,13 @@ Function > toIntervalMax(final int size) { * Return a new flat-mapper function which returns (emits) the minimal value * of the last n elements. * - * {@code + * {@snippet lang="java": * +----3---+----3---+ * | | | * +----9--8--3--3--1--4--2--9----| * toIntervalMin(3) * +----------3--------1----------| - * }+ * } * * @param size the size of the slice * @paramthe element type @@ -281,13 +281,13 @@ public Stream apply(final C value) { * Return a new flat-mapper function which returns (emits) the maximal value * of the elements emitted within the given {@code timespan}. * - * {@code + * {@snippet lang="java": * +---3s---+---3s---+ * | | | * +----9--8--3--3--5--4--2--9----| * toIntervalMax(3s) * +----------9--------5----------| - * }+ * } * * @see #toIntervalMax(Duration, Clock) * @@ -307,13 +307,13 @@ Function> toIntervalMax(final Duration timespan) { * Return a new flat-mapper function which returns (emits) the maximal value * of the elements emitted within the given {@code timespan}. * - * {@code + * {@snippet lang="java": * +---3s---+---3s---+ * | | | * +----9--8--3--3--5--4--2--9----| * toIntervalMax(3s) * +----------9--------5----------| - * }+ * } * * @see #toIntervalMax(Duration) * @@ -334,13 +334,13 @@ Function> toIntervalMax(final Duration timespan, final Clock clock) * Return a new flat-mapper function which returns (emits) the minimal value * of the elements emitted within the given {@code timespan}. * - * {@code + * {@snippet lang="java": * +---3s---+---3s---+ * | | | * +----9--8--3--3--1--4--2--9----| * toIntervalMin(3s) * +----------3--------1----------| - * }+ * } * * @see #toIntervalMin(Duration, Clock) * @@ -360,13 +360,13 @@ Function> toIntervalMin(final Duration timespan) { * Return a new flat-mapper function which returns (emits) the minimal value * of the elements emitted within the given {@code timespan}. * - * {@code + * {@snippet lang="java": * +---3s---+---3s---+ * | | | * +----9--8--3--3--1--4--2--9----| * toIntervalMin(3s) * +----------3--------1----------| - * }+ * } * * @see #toIntervalMin(Duration) *