From 7819e19e6feefeebf4bb2af9628a1f19b627959f Mon Sep 17 00:00:00 2001 From: Riccardo Azzolini Date: Wed, 7 Aug 2019 13:08:09 +0200 Subject: [PATCH] Make Function visitor an inner interface of Function --- .../it/cavallium/warppi/math/Function.java | 42 ++++++++++++++++++- .../warppi/math/FunctionVisitor.java | 40 ------------------ .../warppi/math/functions/Division.java | 3 +- .../warppi/math/functions/Expression.java | 3 +- .../cavallium/warppi/math/functions/Joke.java | 3 +- .../warppi/math/functions/Logarithm.java | 3 +- .../warppi/math/functions/Multiplication.java | 2 +- .../warppi/math/functions/Negative.java | 2 +- .../warppi/math/functions/Number.java | 3 +- .../warppi/math/functions/Power.java | 3 +- .../cavallium/warppi/math/functions/Root.java | 3 +- .../warppi/math/functions/RootSquare.java | 3 +- .../warppi/math/functions/Subtraction.java | 2 +- .../cavallium/warppi/math/functions/Sum.java | 2 +- .../warppi/math/functions/SumSubtraction.java | 2 +- .../warppi/math/functions/Undefined.java | 3 +- .../warppi/math/functions/Variable.java | 3 +- .../math/functions/equations/Equation.java | 3 +- .../functions/equations/EquationsSystem.java | 3 +- .../equations/EquationsSystemPart.java | 4 +- .../functions/trigonometry/ArcCosine.java | 3 +- .../math/functions/trigonometry/ArcSine.java | 3 +- .../functions/trigonometry/ArcTangent.java | 3 +- .../math/functions/trigonometry/Cosine.java | 3 +- .../math/functions/trigonometry/Sine.java | 3 +- .../math/functions/trigonometry/Tangent.java | 3 +- .../warppi/math/rules/dsl/VisitorPattern.java | 3 +- 27 files changed, 66 insertions(+), 87 deletions(-) delete mode 100644 core/src/main/java/it/cavallium/warppi/math/FunctionVisitor.java diff --git a/core/src/main/java/it/cavallium/warppi/math/Function.java b/core/src/main/java/it/cavallium/warppi/math/Function.java index 24494324..07946ed3 100644 --- a/core/src/main/java/it/cavallium/warppi/math/Function.java +++ b/core/src/main/java/it/cavallium/warppi/math/Function.java @@ -1,6 +1,12 @@ package it.cavallium.warppi.math; import it.cavallium.warppi.gui.expression.blocks.Block; +import it.cavallium.warppi.math.functions.*; +import it.cavallium.warppi.math.functions.Number; +import it.cavallium.warppi.math.functions.equations.Equation; +import it.cavallium.warppi.math.functions.equations.EquationsSystem; +import it.cavallium.warppi.math.functions.equations.EquationsSystemPart; +import it.cavallium.warppi.math.functions.trigonometry.*; import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -82,11 +88,43 @@ public interface Function { ObjectArrayList toBlock(MathContext context) throws Error; /** - * Accepts a FunctionVisitor by calling the correct overload of visit. + * Accepts a Function.Visitor by calling the correct overload of visit. * * @param visitor The visitor to be accepted. * @param The return type of the visit method. * @return The value returned by visit. */ - T accept(FunctionVisitor visitor); + T accept(Visitor visitor); + + /** + * Executes a different overload of a method for each Function implementation. + * + * @param The return type of all visit method overloads. + */ + interface Visitor { + T visit(ArcCosine arcCosine); + T visit(ArcSine arcSine); + T visit(ArcTangent arcTangent); + T visit(Cosine cosine); + T visit(Division division); + T visit(Equation equation); + T visit(EquationsSystem equationsSystem); + T visit(EquationsSystemPart equationsSystemPart); + T visit(Expression expression); + T visit(Joke joke); + T visit(Logarithm logarithm); + T visit(Multiplication multiplication); + T visit(Negative negative); + T visit(Number number); + T visit(Power power); + T visit(Root root); + T visit(RootSquare rootSquare); + T visit(Sine sine); + T visit(Subtraction subtraction); + T visit(SumSubtraction sumSubtraction); + T visit(Sum sum); + T visit(Tangent tangent); + T visit(Undefined undefined); + T visit(Variable variable); + } } diff --git a/core/src/main/java/it/cavallium/warppi/math/FunctionVisitor.java b/core/src/main/java/it/cavallium/warppi/math/FunctionVisitor.java deleted file mode 100644 index 148535c6..00000000 --- a/core/src/main/java/it/cavallium/warppi/math/FunctionVisitor.java +++ /dev/null @@ -1,40 +0,0 @@ -package it.cavallium.warppi.math; - -import it.cavallium.warppi.math.functions.*; -import it.cavallium.warppi.math.functions.Number; -import it.cavallium.warppi.math.functions.equations.Equation; -import it.cavallium.warppi.math.functions.equations.EquationsSystem; -import it.cavallium.warppi.math.functions.equations.EquationsSystemPart; -import it.cavallium.warppi.math.functions.trigonometry.*; - -/** - * Executes a different overload of a method for each Function implementation. - * - * @param The return type of all visit method overloads. - */ -public interface FunctionVisitor { - T visit(ArcCosine arcCosine); - T visit(ArcSine arcSine); - T visit(ArcTangent arcTangent); - T visit(Cosine cosine); - T visit(Division division); - T visit(Equation equation); - T visit(EquationsSystem equationsSystem); - T visit(EquationsSystemPart equationsSystemPart); - T visit(Expression expression); - T visit(Joke joke); - T visit(Logarithm logarithm); - T visit(Multiplication multiplication); - T visit(Negative negative); - T visit(Number number); - T visit(Power power); - T visit(Root root); - T visit(RootSquare rootSquare); - T visit(Sine sine); - T visit(Subtraction subtraction); - T visit(SumSubtraction sumSubtraction); - T visit(Sum sum); - T visit(Tangent tangent); - T visit(Undefined undefined); - T visit(Variable variable); -} 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 d1b33528..559ff7e2 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 @@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer; import it.cavallium.warppi.gui.expression.blocks.BlockDivision; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionOperator; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -62,7 +61,7 @@ public class Division extends FunctionOperator { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor visitor) { return visitor.visit(this); } } \ No newline at end of file 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 d503fea2..48310b49 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 @@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer; import it.cavallium.warppi.gui.expression.blocks.BlockParenthesis; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.functions.trigonometry.ArcCosine; import it.cavallium.warppi.math.functions.trigonometry.ArcSine; @@ -584,7 +583,7 @@ public class Expression extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 1c6b5ca4..e2aca686 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 @@ -2,7 +2,6 @@ package it.cavallium.warppi.math.functions; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.util.Error; @@ -63,7 +62,7 @@ public class Joke implements Function { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 06b426c3..631c56ba 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 @@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer; import it.cavallium.warppi.gui.expression.blocks.BlockLogarithm; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionOperator; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -57,7 +56,7 @@ public class Logarithm extends FunctionOperator { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 4552e08a..182d8981 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(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 67362a94..ab49dd99 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(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 11344419..0ddd8e9c 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 @@ -4,7 +4,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.LinkedList; -import it.cavallium.warppi.math.FunctionVisitor; import org.nevec.rjm.BigDecimalMath; import it.cavallium.warppi.gui.expression.blocks.Block; @@ -275,7 +274,7 @@ public class Number implements Function { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 6ba2c79a..a3c5abae 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 @@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer; import it.cavallium.warppi.gui.expression.blocks.BlockPower; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionOperator; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -53,7 +52,7 @@ public class Power extends FunctionOperator { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 8a49095a..b147ce8e 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionOperator; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Errors; @@ -41,7 +40,7 @@ public class Root extends FunctionOperator { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 bd30742e..b70a9568 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 @@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer; import it.cavallium.warppi.gui.expression.blocks.BlockSquareRoot; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionOperator; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -50,7 +49,7 @@ public class RootSquare extends FunctionOperator { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 6166c122..b9d29f64 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(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 72ff3def..1b72b09c 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(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 dc179d4d..590788ba 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(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 dda2ce55..14c54973 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.BlockUndefined; import it.cavallium.warppi.math.Function; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.util.Error; @@ -60,7 +59,7 @@ public class Undefined implements Function { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 da2041d8..846937d2 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.BlockChar; import it.cavallium.warppi.math.Function; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.util.Error; @@ -134,7 +133,7 @@ public class Variable implements Function { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 093f18b7..b024f833 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 @@ -7,7 +7,6 @@ import java.util.Set; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionOperator; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.solver.SolveMethod; import it.cavallium.warppi.util.Error; @@ -77,7 +76,7 @@ public class Equation extends FunctionOperator { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 348ad0dd..028388af 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.equations; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionDynamic; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -65,7 +64,7 @@ public class EquationsSystem extends FunctionDynamic { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 5f1e10f3..0a7c5730 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 @@ -1,8 +1,8 @@ package it.cavallium.warppi.math.functions.equations; import it.cavallium.warppi.gui.expression.blocks.Block; +import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -36,7 +36,7 @@ public class EquationsSystemPart extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 ef03cbc9..b5848987 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Errors; @@ -45,7 +44,7 @@ public class ArcCosine extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 0b8dd0ab..83db885a 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Errors; @@ -45,7 +44,7 @@ public class ArcSine extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 cf627d62..c3a8de38 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Errors; @@ -45,7 +44,7 @@ public class ArcTangent extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 f0f1a768..f20e8483 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Errors; @@ -45,7 +44,7 @@ public class Cosine extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 b72c9858..8fe735ac 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 @@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer; import it.cavallium.warppi.gui.expression.blocks.BlockSine; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -53,7 +52,7 @@ public class Sine extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 f6751935..f325047c 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 @@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry; import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.FunctionSingle; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.util.Error; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -44,7 +43,7 @@ public class Tangent extends FunctionSingle { } @Override - public T accept(final FunctionVisitor visitor) { + public T accept(final Function.Visitor 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 3532d5b3..bdd8e498 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 @@ -1,7 +1,6 @@ package it.cavallium.warppi.math.rules.dsl; import it.cavallium.warppi.math.Function; -import it.cavallium.warppi.math.FunctionVisitor; import it.cavallium.warppi.math.functions.*; import it.cavallium.warppi.math.functions.Number; import it.cavallium.warppi.math.functions.equations.Equation; @@ -15,7 +14,7 @@ import java.util.Optional; /** * A Pattern which implements match as a visitor. */ -public abstract class VisitorPattern implements Pattern, FunctionVisitor>> { +public abstract class VisitorPattern implements Pattern, Function.Visitor>> { @Override public Optional> match(final Function function) { return function.accept(this);