Make Function visitor an inner interface of Function

This commit is contained in:
Riccardo Azzolini 2019-08-07 13:08:09 +02:00
parent 86c7da8c81
commit 7819e19e6f
27 changed files with 66 additions and 87 deletions

View File

@ -1,6 +1,12 @@
package it.cavallium.warppi.math; package it.cavallium.warppi.math;
import it.cavallium.warppi.gui.expression.blocks.Block; 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.math.rules.Rule;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -82,11 +88,43 @@ public interface Function {
ObjectArrayList<Block> toBlock(MathContext context) throws Error; ObjectArrayList<Block> toBlock(MathContext context) throws Error;
/** /**
* Accepts a <code>FunctionVisitor</code> by calling the correct overload of <code>visit</code>. * Accepts a <code>Function.Visitor</code> by calling the correct overload of <code>visit</code>.
* *
* @param visitor The visitor to be accepted. * @param visitor The visitor to be accepted.
* @param <T> The return type of the <code>visit</code> method. * @param <T> The return type of the <code>visit</code> method.
* @return The value returned by <code>visit</code>. * @return The value returned by <code>visit</code>.
*/ */
<T> T accept(FunctionVisitor<T> visitor); <T> T accept(Visitor<T> visitor);
/**
* Executes a different overload of a method for each <code>Function</code> implementation.
*
* @param <T> The return type of all <code>visit</code> method overloads.
*/
interface Visitor<T> {
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);
}
} }

View File

@ -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 <code>Function</code> implementation.
*
* @param <T> The return type of all <code>visit</code> method overloads.
*/
public interface FunctionVisitor<T> {
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);
}

View File

@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
import it.cavallium.warppi.gui.expression.blocks.BlockDivision; import it.cavallium.warppi.gui.expression.blocks.BlockDivision;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionOperator; import it.cavallium.warppi.math.FunctionOperator;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -62,7 +61,7 @@ public class Division extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }
} }

View File

@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
import it.cavallium.warppi.gui.expression.blocks.BlockParenthesis; import it.cavallium.warppi.gui.expression.blocks.BlockParenthesis;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.math.functions.trigonometry.ArcCosine; import it.cavallium.warppi.math.functions.trigonometry.ArcCosine;
import it.cavallium.warppi.math.functions.trigonometry.ArcSine; import it.cavallium.warppi.math.functions.trigonometry.ArcSine;
@ -584,7 +583,7 @@ public class Expression extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -2,7 +2,6 @@ package it.cavallium.warppi.math.functions;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.math.rules.Rule;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
@ -63,7 +62,7 @@ public class Joke implements Function {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
import it.cavallium.warppi.gui.expression.blocks.BlockLogarithm; import it.cavallium.warppi.gui.expression.blocks.BlockLogarithm;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionOperator; import it.cavallium.warppi.math.FunctionOperator;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -57,7 +56,7 @@ public class Logarithm extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -85,7 +85,7 @@ public class Multiplication extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -51,7 +51,7 @@ public class Negative extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }
} }

View File

@ -4,7 +4,6 @@ import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.LinkedList; import java.util.LinkedList;
import it.cavallium.warppi.math.FunctionVisitor;
import org.nevec.rjm.BigDecimalMath; import org.nevec.rjm.BigDecimalMath;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
@ -275,7 +274,7 @@ public class Number implements Function {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
import it.cavallium.warppi.gui.expression.blocks.BlockPower; import it.cavallium.warppi.gui.expression.blocks.BlockPower;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionOperator; import it.cavallium.warppi.math.FunctionOperator;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -53,7 +52,7 @@ public class Power extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }
} }

View File

@ -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.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionOperator; import it.cavallium.warppi.math.FunctionOperator;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.cavallium.warppi.util.Errors; import it.cavallium.warppi.util.Errors;
@ -41,7 +40,7 @@ public class Root extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
import it.cavallium.warppi.gui.expression.blocks.BlockSquareRoot; import it.cavallium.warppi.gui.expression.blocks.BlockSquareRoot;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionOperator; import it.cavallium.warppi.math.FunctionOperator;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -50,7 +49,7 @@ public class RootSquare extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -41,7 +41,7 @@ public class Subtraction extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -45,7 +45,7 @@ public class Sum extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }
} }

View File

@ -41,7 +41,7 @@ public class SumSubtraction extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -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.Block;
import it.cavallium.warppi.gui.expression.blocks.BlockUndefined; import it.cavallium.warppi.gui.expression.blocks.BlockUndefined;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.math.rules.Rule;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
@ -60,7 +59,7 @@ public class Undefined implements Function {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -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.Block;
import it.cavallium.warppi.gui.expression.blocks.BlockChar; import it.cavallium.warppi.gui.expression.blocks.BlockChar;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.math.rules.Rule; import it.cavallium.warppi.math.rules.Rule;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
@ -134,7 +133,7 @@ public class Variable implements Function {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }
} }

View File

@ -7,7 +7,6 @@ import java.util.Set;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionOperator; import it.cavallium.warppi.math.FunctionOperator;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.math.solver.SolveMethod; import it.cavallium.warppi.math.solver.SolveMethod;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
@ -77,7 +76,7 @@ public class Equation extends FunctionOperator {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.equations;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionDynamic; import it.cavallium.warppi.math.FunctionDynamic;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -65,7 +64,7 @@ public class EquationsSystem extends FunctionDynamic {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -1,8 +1,8 @@
package it.cavallium.warppi.math.functions.equations; package it.cavallium.warppi.math.functions.equations;
import it.cavallium.warppi.gui.expression.blocks.Block; 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.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -36,7 +36,7 @@ public class EquationsSystemPart extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.cavallium.warppi.util.Errors; import it.cavallium.warppi.util.Errors;
@ -45,7 +44,7 @@ public class ArcCosine extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.cavallium.warppi.util.Errors; import it.cavallium.warppi.util.Errors;
@ -45,7 +44,7 @@ public class ArcSine extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.cavallium.warppi.util.Errors; import it.cavallium.warppi.util.Errors;
@ -45,7 +44,7 @@ public class ArcTangent extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.cavallium.warppi.util.Errors; import it.cavallium.warppi.util.Errors;
@ -45,7 +44,7 @@ public class Cosine extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -5,7 +5,6 @@ import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
import it.cavallium.warppi.gui.expression.blocks.BlockSine; import it.cavallium.warppi.gui.expression.blocks.BlockSine;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -53,7 +52,7 @@ public class Sine extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -3,7 +3,6 @@ package it.cavallium.warppi.math.functions.trigonometry;
import it.cavallium.warppi.gui.expression.blocks.Block; import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionSingle; import it.cavallium.warppi.math.FunctionSingle;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext; import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error; import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -44,7 +43,7 @@ public class Tangent extends FunctionSingle {
} }
@Override @Override
public <T> T accept(final FunctionVisitor<T> visitor) { public <T> T accept(final Function.Visitor<T> visitor) {
return visitor.visit(this); return visitor.visit(this);
} }

View File

@ -1,7 +1,6 @@
package it.cavallium.warppi.math.rules.dsl; package it.cavallium.warppi.math.rules.dsl;
import it.cavallium.warppi.math.Function; import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.functions.*; import it.cavallium.warppi.math.functions.*;
import it.cavallium.warppi.math.functions.Number; import it.cavallium.warppi.math.functions.Number;
import it.cavallium.warppi.math.functions.equations.Equation; import it.cavallium.warppi.math.functions.equations.Equation;
@ -15,7 +14,7 @@ import java.util.Optional;
/** /**
* A <code>Pattern</code> which implements <code>match</code> as a visitor. * A <code>Pattern</code> which implements <code>match</code> as a visitor.
*/ */
public abstract class VisitorPattern implements Pattern, FunctionVisitor<Optional<Map<String, Function>>> { public abstract class VisitorPattern implements Pattern, Function.Visitor<Optional<Map<String, Function>>> {
@Override @Override
public Optional<Map<String, Function>> match(final Function function) { public Optional<Map<String, Function>> match(final Function function) {
return function.accept(this); return function.accept(this);