Skip to content

Commit

Permalink
Minor code improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
jenetics committed Feb 9, 2021
1 parent 0b92b55 commit ca31cde
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*
* @see WeaselSelector
* @see WeaselMutator
* @see io.jenetics.engine.Engine.Builder#setup(Setup)
*
* @param <G> the gene type
* @param <C> the fitness result type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ private int rewriting(final TreeNode<Op<T>> node) {
node.value(Const.of(value));

return 1;
} else {
return 0;
}

return 0;
}

@SuppressWarnings("unchecked")
Expand Down
8 changes: 2 additions & 6 deletions jenetics.prog/src/main/java/io/jenetics/prog/op/MathOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package io.jenetics.prog.op;

import static io.jenetics.prog.op.Numbers.box;
import static java.lang.Math.abs;
import static java.lang.Math.acos;
import static java.lang.Math.asin;
Expand Down Expand Up @@ -47,7 +48,6 @@
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.DoubleStream;
import java.util.stream.Stream;

import io.jenetics.ext.util.Tree;
Expand Down Expand Up @@ -386,11 +386,7 @@ public Double apply(final Double[] args) {
* @return the evaluated operation
*/
public double eval(final double... args) {
return apply(
DoubleStream.of(args)
.boxed()
.toArray(Double[]::new)
);
return apply(box(args));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion jenetics/src/main/java/io/jenetics/engine/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ public Builder<G, C> copy() {
* @since 6.0
*/
@FunctionalInterface
public static interface Setup<
public interface Setup<
G extends Gene<?, G>,
C extends Comparable<? super C>
> {
Expand Down

0 comments on commit ca31cde

Please sign in to comment.