Skip to content

Commit

Permalink
#566: Improve Javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
jenetics committed Feb 3, 2020
1 parent 9b51ab9 commit a7fd207
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions jenetics/src/main/java/io/jenetics/engine/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ public final class Engine<
private final Constraint<G, C> _constraint;
private final Optimize _optimize;

// private final ProblemParams<G, C> _problemParams;
// private final EvolutionParams<G, C> _evolutionParams;
// private final ExecutionParams<G, C> _executionParams;

// Evolution parameters.
private final EvolutionParams<G, C> _evolutionParams;

Expand Down Expand Up @@ -693,7 +689,8 @@ public static final class Builder<
private Optimize _optimize = Optimize.MAXIMUM;

// Evolution parameters.
private final EvolutionParams.Builder<G, C> _evolutionParams = EvolutionParams.builder();
private final EvolutionParams.Builder<G, C> _evolutionParams =
EvolutionParams.builder();


// Engine execution environment.
Expand Down Expand Up @@ -726,6 +723,15 @@ public Builder(
_evaluator = requireNonNull(evaluator);
}

/**
* Set the evolution parameters used by the engine.
*
* @since !__version__!
*
* @param params the evolution parameter
* @return {@code this} builder, for command chaining
* @throws NullPointerException if the {@code params} is {@code null}.
*/
public Builder<G, C> evolutionParams(final EvolutionParams<G, C> params) {
_evolutionParams.evolutionParams(params);
return this;
Expand All @@ -737,10 +743,10 @@ public Builder<G, C> evolutionParams(final EvolutionParams<G, C> params) {
*
* @param selector used for selecting the offspring population
* @return {@code this} builder, for command chaining
* @throws NullPointerException if one of the {@code selector} is
* {@code null}.
*/
public Builder<G, C> offspringSelector(
final Selector<G, C> selector
) {
public Builder<G, C> offspringSelector(final Selector<G, C> selector) {
_evolutionParams.offspringSelector(selector);
return this;
}
Expand All @@ -751,10 +757,10 @@ public Builder<G, C> offspringSelector(
*
* @param selector used for selecting survivors population
* @return {@code this} builder, for command chaining
* @throws NullPointerException if one of the {@code selector} is
* {@code null}.
*/
public Builder<G, C> survivorsSelector(
final Selector<G, C> selector
) {
public Builder<G, C> survivorsSelector(final Selector<G, C> selector) {
_evolutionParams.survivorsSelector(selector);
return this;
}
Expand All @@ -766,6 +772,8 @@ public Builder<G, C> survivorsSelector(
*
* @param selector used for selecting survivors and offspring population
* @return {@code this} builder, for command chaining
* @throws NullPointerException if one of the {@code selector} is
* {@code null}.
*/
public Builder<G, C> selector(final Selector<G, C> selector) {
_evolutionParams.selector(selector);
Expand All @@ -782,8 +790,7 @@ public Builder<G, C> selector(final Selector<G, C> selector) {
* @param rest the rest of the alterers used for alter the offspring
* population
* @return {@code this} builder, for command chaining
* @throws java.lang.NullPointerException if one of the alterers is
* {@code null}.
* @throws NullPointerException if one of the alterers is {@code null}.
*/
@SafeVarargs
public final Builder<G, C> alterers(
Expand All @@ -807,6 +814,8 @@ public final Builder<G, C> alterers(
* implementation the {@link Phenotype#isValid()} method and repairs
* invalid phenotypes when needed.
* @return {@code this} builder, for command chaining
* @throws NullPointerException if one of the {@code constraint} is
* {@code null}.
*/
public Builder<G, C> constraint(final Constraint<G, C> constraint) {
_constraint = constraint;
Expand All @@ -819,6 +828,8 @@ public Builder<G, C> constraint(final Constraint<G, C> constraint) {
*
* @param optimize the optimization strategy used by the engine
* @return {@code this} builder, for command chaining
* @throws NullPointerException if one of the {@code optimize} is
* {@code null}.
*/
public Builder<G, C> optimize(final Optimize optimize) {
_optimize = requireNonNull(optimize);
Expand Down Expand Up @@ -1079,6 +1090,13 @@ public Constraint<G, C> getConstraint() {
return _constraint;
}

/**
* Return the currently set evolution parameters.
*
* @since !__version__!
*
* @return the currently set evolution parameters
*/
public EvolutionParams<G, C> evolutionParams() {
return _evolutionParams.build();
}
Expand Down

0 comments on commit a7fd207

Please sign in to comment.