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;
public interface Function {
/**
* Returns this function and its children in a string form.
*
* @return This function and its children in a string form.
*/
@Override
String toString();
/**
* Indicates whether some other object is a Function
which is identical to this one.
*
* Two functions which are not identical, but only equivalent (due to, for example, the commutative property) aren't
* considered equal.
*
* @param o the other object to compare.
* @return true
if the other object is identical to this Function
, false
* otherwise.
*/
@Override
boolean equals(Object o);
/**
* Deep clone this function.
*
* @return A clone of this function.
*/
Function clone();
/**
* Deep clone this function, also change mathContext.
*
* @param newMathContext new mathContext
* @return A clone of this function.
*/
Function clone(MathContext newMathContext);
/**
* Generic method to change a parameter in a known position.
*
* @param index
* parameter index.
* @param var
* parameter.
* @return A new instance of this function.
*/
Function setParameter(int index, Function var) throws IndexOutOfBoundsException;
/**
* Generic method to retrieve a parameter in a known position.
*
* @param index
* parameter index.
* @return The requested parameter.
*/
Function getParameter(int index) throws IndexOutOfBoundsException;
/**
* Retrieve the current Math Context used by this function
*
* @return Calculator mathContext
*/
MathContext getMathContext();
/**
* Simplify the current function or it's children using the specified
* rule
*
* @param rule
* @return A list of the resulting Functions if the rule is applicable and
* something changed, null otherwise
* @throws Error
* @throws InterruptedException
*/
ObjectArrayListvisit
.
*
* @param visitor The visitor to be accepted.
* @param argument An additional argument to be passed to visit
.
* @param visit
method.
* @param visit
method.
* @return The value returned by visit
.
*/
Function
implementation.
*
* @param visit
method overloads.
* If the argument is not required, this type parameter should be set to {@link Void}.
* @param visit
method overloads.
*/
interface Visitor