From be5ae2d475d978eb6e63cde65386b1d14de50753 Mon Sep 17 00:00:00 2001 From: Riccardo Azzolini Date: Sat, 6 Oct 2018 15:11:18 +0200 Subject: [PATCH] Add missing 'final' specifiers --- .../warppi/math/functions/Division.java | 2 +- .../warppi/math/functions/EmptyNumber.java | 2 +- .../warppi/math/functions/Expression.java | 2 +- .../cavallium/warppi/math/functions/Joke.java | 2 +- .../warppi/math/functions/Logarithm.java | 2 +- .../warppi/math/functions/Multiplication.java | 2 +- .../warppi/math/functions/Negative.java | 2 +- .../warppi/math/functions/Number.java | 2 +- .../warppi/math/functions/Power.java | 2 +- .../cavallium/warppi/math/functions/Root.java | 2 +- .../warppi/math/functions/RootSquare.java | 2 +- .../warppi/math/functions/Subtraction.java | 2 +- .../cavallium/warppi/math/functions/Sum.java | 2 +- .../warppi/math/functions/SumSubtraction.java | 2 +- .../warppi/math/functions/Undefined.java | 2 +- .../warppi/math/functions/Variable.java | 2 +- .../math/functions/equations/Equation.java | 2 +- .../functions/equations/EquationsSystem.java | 2 +- .../equations/EquationsSystemPart.java | 2 +- .../functions/trigonometry/ArcCosine.java | 2 +- .../math/functions/trigonometry/ArcSine.java | 2 +- .../functions/trigonometry/ArcTangent.java | 2 +- .../math/functions/trigonometry/Cosine.java | 2 +- .../math/functions/trigonometry/Sine.java | 2 +- .../math/functions/trigonometry/Tangent.java | 2 +- .../warppi/math/rules/dsl/VisitorPattern.java | 60 +++++++++---------- .../rules/dsl/patterns/NegativePattern.java | 6 +- .../rules/dsl/patterns/NumberPattern.java | 6 +- .../dsl/patterns/SubFunctionPattern.java | 8 +-- .../math/rules/dsl/patterns/SumPattern.java | 6 +- 30 files changed, 68 insertions(+), 68 deletions(-) diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Division.java b/core/src/main/java/it/cavallium/warppi/math/functions/Division.java index 6baeeabc..d1b33528 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Division.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Division.java @@ -62,7 +62,7 @@ public class Division extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } } \ No newline at end of file diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/EmptyNumber.java b/core/src/main/java/it/cavallium/warppi/math/functions/EmptyNumber.java index 656446c8..bbdefc25 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/EmptyNumber.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/EmptyNumber.java @@ -58,7 +58,7 @@ public class EmptyNumber implements Function { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Expression.java b/core/src/main/java/it/cavallium/warppi/math/functions/Expression.java index 72aabb89..d503fea2 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Expression.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Expression.java @@ -584,7 +584,7 @@ public class Expression extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Joke.java b/core/src/main/java/it/cavallium/warppi/math/functions/Joke.java index 8065ee6a..1c6b5ca4 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Joke.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Joke.java @@ -63,7 +63,7 @@ public class Joke implements Function { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Logarithm.java b/core/src/main/java/it/cavallium/warppi/math/functions/Logarithm.java index 04bcd65b..06b426c3 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Logarithm.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Logarithm.java @@ -57,7 +57,7 @@ public class Logarithm extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Multiplication.java b/core/src/main/java/it/cavallium/warppi/math/functions/Multiplication.java index 6e632af4..4552e08a 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Multiplication.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Multiplication.java @@ -85,7 +85,7 @@ public class Multiplication extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Negative.java b/core/src/main/java/it/cavallium/warppi/math/functions/Negative.java index a6733547..67362a94 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Negative.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Negative.java @@ -51,7 +51,7 @@ public class Negative extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Number.java b/core/src/main/java/it/cavallium/warppi/math/functions/Number.java index a6398d2a..11344419 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Number.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Number.java @@ -275,7 +275,7 @@ public class Number implements Function { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Power.java b/core/src/main/java/it/cavallium/warppi/math/functions/Power.java index 15940748..6ba2c79a 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Power.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Power.java @@ -53,7 +53,7 @@ public class Power extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Root.java b/core/src/main/java/it/cavallium/warppi/math/functions/Root.java index 0ab1d6f6..8a49095a 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Root.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Root.java @@ -41,7 +41,7 @@ public class Root extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/RootSquare.java b/core/src/main/java/it/cavallium/warppi/math/functions/RootSquare.java index 2a1afa2f..936f72d5 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/RootSquare.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/RootSquare.java @@ -50,7 +50,7 @@ public class RootSquare extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Subtraction.java b/core/src/main/java/it/cavallium/warppi/math/functions/Subtraction.java index 452fbfc4..6166c122 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Subtraction.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Subtraction.java @@ -41,7 +41,7 @@ public class Subtraction extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Sum.java b/core/src/main/java/it/cavallium/warppi/math/functions/Sum.java index 36ff3814..72ff3def 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Sum.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Sum.java @@ -45,7 +45,7 @@ public class Sum extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/SumSubtraction.java b/core/src/main/java/it/cavallium/warppi/math/functions/SumSubtraction.java index 35d04df9..dc179d4d 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/SumSubtraction.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/SumSubtraction.java @@ -41,7 +41,7 @@ public class SumSubtraction extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Undefined.java b/core/src/main/java/it/cavallium/warppi/math/functions/Undefined.java index 93d74f38..dda2ce55 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Undefined.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Undefined.java @@ -60,7 +60,7 @@ public class Undefined implements Function { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/Variable.java b/core/src/main/java/it/cavallium/warppi/math/functions/Variable.java index 885992f7..6baf6792 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/Variable.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/Variable.java @@ -133,7 +133,7 @@ public class Variable implements Function { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/equations/Equation.java b/core/src/main/java/it/cavallium/warppi/math/functions/equations/Equation.java index 7232a69c..bafa8d9b 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/equations/Equation.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/equations/Equation.java @@ -70,7 +70,7 @@ public class Equation extends FunctionOperator { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystem.java b/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystem.java index a79c2bda..2ef133a5 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystem.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystem.java @@ -48,7 +48,7 @@ public class EquationsSystem extends FunctionDynamic { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystemPart.java b/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystemPart.java index e6670fb3..5f1e10f3 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystemPart.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/equations/EquationsSystemPart.java @@ -36,7 +36,7 @@ public class EquationsSystemPart extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcCosine.java b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcCosine.java index ed722ba8..a9a36a74 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcCosine.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcCosine.java @@ -40,7 +40,7 @@ public class ArcCosine extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcSine.java b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcSine.java index 8989c5a3..29df7372 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcSine.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcSine.java @@ -40,7 +40,7 @@ public class ArcSine extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcTangent.java b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcTangent.java index 0064b546..7d083f83 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcTangent.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/ArcTangent.java @@ -40,7 +40,7 @@ public class ArcTangent extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Cosine.java b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Cosine.java index d00c65c6..3499f9c5 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Cosine.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Cosine.java @@ -40,7 +40,7 @@ public class Cosine extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Sine.java b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Sine.java index b1c99ffa..b72c9858 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Sine.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Sine.java @@ -53,7 +53,7 @@ public class Sine extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Tangent.java b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Tangent.java index c224fb89..4687d384 100644 --- a/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Tangent.java +++ b/core/src/main/java/it/cavallium/warppi/math/functions/trigonometry/Tangent.java @@ -39,7 +39,7 @@ public class Tangent extends FunctionSingle { } @Override - public T accept(FunctionVisitor visitor) { + public T accept(final FunctionVisitor visitor) { return visitor.visit(this); } diff --git a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/VisitorPattern.java b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/VisitorPattern.java index f698799d..999dbead 100644 --- a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/VisitorPattern.java +++ b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/VisitorPattern.java @@ -18,7 +18,7 @@ import java.util.Optional; */ public abstract class VisitorPattern implements Pattern, FunctionVisitor>> { @Override - public Optional> match(Function function) { + public Optional> match(final Function function) { return function.accept(this); } @@ -33,20 +33,20 @@ public abstract class VisitorPattern implements Pattern, FunctionVisitor> mergeMatches( - Map match1, - Map match2 + final Map match1, + final Map match2 ) { if (!checkSubFunctionEquality(match1, match2)) { return Optional.empty(); } - Map merged = new HashMap<>(); + final Map merged = new HashMap<>(); merged.putAll(match1); merged.putAll(match2); return Optional.of(merged); } - private boolean checkSubFunctionEquality(Map match1, Map match2) { + private boolean checkSubFunctionEquality(final Map match1, final Map match2) { for (Map.Entry leftSubFunction : match1.entrySet()) { final String key = leftSubFunction.getKey(); if (match2.containsKey(key) @@ -58,127 +58,127 @@ public abstract class VisitorPattern implements Pattern, FunctionVisitor> visit(ArcCosine arcCosine) { + public Optional> visit(final ArcCosine arcCosine) { return Optional.empty(); } @Override - public Optional> visit(ArcSine arcSine) { + public Optional> visit(final ArcSine arcSine) { return Optional.empty(); } @Override - public Optional> visit(ArcTangent arcTangent) { + public Optional> visit(final ArcTangent arcTangent) { return Optional.empty(); } @Override - public Optional> visit(Cosine cosine) { + public Optional> visit(final Cosine cosine) { return Optional.empty(); } @Override - public Optional> visit(Division division) { + public Optional> visit(final Division division) { return Optional.empty(); } @Override - public Optional> visit(EmptyNumber emptyNumber) { + public Optional> visit(final EmptyNumber emptyNumber) { return Optional.empty(); } @Override - public Optional> visit(Equation equation) { + public Optional> visit(final Equation equation) { return Optional.empty(); } @Override - public Optional> visit(EquationsSystem equationsSystem) { + public Optional> visit(final EquationsSystem equationsSystem) { return Optional.empty(); } @Override - public Optional> visit(EquationsSystemPart equationsSystemPart) { + public Optional> visit(final EquationsSystemPart equationsSystemPart) { return Optional.empty(); } @Override - public Optional> visit(Expression expression) { + public Optional> visit(final Expression expression) { return Optional.empty(); } @Override - public Optional> visit(Joke joke) { + public Optional> visit(final Joke joke) { return Optional.empty(); } @Override - public Optional> visit(Logarithm logarithm) { + public Optional> visit(final Logarithm logarithm) { return Optional.empty(); } @Override - public Optional> visit(Multiplication multiplication) { + public Optional> visit(final Multiplication multiplication) { return Optional.empty(); } @Override - public Optional> visit(Negative negative) { + public Optional> visit(final Negative negative) { return Optional.empty(); } @Override - public Optional> visit(Number number) { + public Optional> visit(final Number number) { return Optional.empty(); } @Override - public Optional> visit(Power power) { + public Optional> visit(final Power power) { return Optional.empty(); } @Override - public Optional> visit(Root root) { + public Optional> visit(final Root root) { return Optional.empty(); } @Override - public Optional> visit(RootSquare rootSquare) { + public Optional> visit(final RootSquare rootSquare) { return Optional.empty(); } @Override - public Optional> visit(Sine sine) { + public Optional> visit(final Sine sine) { return Optional.empty(); } @Override - public Optional> visit(Subtraction subtraction) { + public Optional> visit(final Subtraction subtraction) { return Optional.empty(); } @Override - public Optional> visit(SumSubtraction sumSubtraction) { + public Optional> visit(final SumSubtraction sumSubtraction) { return Optional.empty(); } @Override - public Optional> visit(Sum sum) { + public Optional> visit(final Sum sum) { return Optional.empty(); } @Override - public Optional> visit(Tangent tangent) { + public Optional> visit(final Tangent tangent) { return Optional.empty(); } @Override - public Optional> visit(Undefined undefined) { + public Optional> visit(final Undefined undefined) { return Optional.empty(); } @Override - public Optional> visit(Variable variable) { + public Optional> visit(final Variable variable) { return Optional.empty(); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NegativePattern.java b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NegativePattern.java index a0a48baa..12c50073 100644 --- a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NegativePattern.java +++ b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NegativePattern.java @@ -15,17 +15,17 @@ import java.util.Optional; public class NegativePattern extends VisitorPattern { private final Pattern inner; - public NegativePattern(Pattern inner) { + public NegativePattern(final Pattern inner) { this.inner = inner; } @Override - public Optional> visit(Negative negative) { + public Optional> visit(final Negative negative) { return inner.match(negative.getParameter()); } @Override - public Function replace(MathContext mathContext, Map subFunctions) { + public Function replace(final MathContext mathContext, final Map subFunctions) { return new Negative( mathContext, inner.replace(mathContext, subFunctions) diff --git a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NumberPattern.java b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NumberPattern.java index 723c606b..a9174b07 100644 --- a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NumberPattern.java +++ b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/NumberPattern.java @@ -16,12 +16,12 @@ import java.util.Optional; public class NumberPattern extends VisitorPattern { private final BigDecimal value; - public NumberPattern(BigDecimal value) { + public NumberPattern(final BigDecimal value) { this.value = value; } @Override - public Optional> visit(Number number) { + public Optional> visit(final Number number) { if (number.getTerm().compareTo(value) == 0) { return Optional.of(new HashMap<>()); } else { @@ -30,7 +30,7 @@ public class NumberPattern extends VisitorPattern { } @Override - public Function replace(MathContext mathContext, Map subFunctions) { + public Function replace(final MathContext mathContext, final Map subFunctions) { return new Number(mathContext, value); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SubFunctionPattern.java b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SubFunctionPattern.java index 5ecd97fc..853aadba 100644 --- a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SubFunctionPattern.java +++ b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SubFunctionPattern.java @@ -14,19 +14,19 @@ import java.util.Optional; public class SubFunctionPattern implements Pattern { private final String name; - public SubFunctionPattern(String name) { + public SubFunctionPattern(final String name) { this.name = name; } @Override - public Optional> match(Function function) { - HashMap subFunctions = new HashMap<>(); + public Optional> match(final Function function) { + final HashMap subFunctions = new HashMap<>(); subFunctions.put(name, function); return Optional.of(subFunctions); } @Override - public Function replace(MathContext mathContext, Map subFunctions) { + public Function replace(final MathContext mathContext, final Map subFunctions) { return subFunctions.get(name); } } diff --git a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SumPattern.java b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SumPattern.java index b3eb5420..babe2cb8 100644 --- a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SumPattern.java +++ b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/patterns/SumPattern.java @@ -16,13 +16,13 @@ public class SumPattern extends VisitorPattern { private final Pattern left; private final Pattern right; - public SumPattern(Pattern left, Pattern right) { + public SumPattern(final Pattern left, final Pattern right) { this.left = left; this.right = right; } @Override - public Optional> visit(Sum sum) { + public Optional> visit(final Sum sum) { return left.match(sum.getParameter1()) .flatMap(leftMatch -> right.match(sum.getParameter2()) .flatMap(rightMatch -> mergeMatches(leftMatch, rightMatch)) @@ -30,7 +30,7 @@ public class SumPattern extends VisitorPattern { } @Override - public Function replace(MathContext mathContext, Map subFunctions) { + public Function replace(final MathContext mathContext, final Map subFunctions) { return new Sum( mathContext, left.replace(mathContext, subFunctions),