public class Functors
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.function.Function<IExpr,IExpr> |
append(IAST ast)
Return a function which clones the given AST and appends the argument to
the cloned AST in the
apply() method. |
static java.util.function.Function<IExpr,IExpr> |
apply(IExpr expr)
Return a function which clones the argument, if it is of type AST and
sets the header to the given
expr. |
static java.util.function.Function<IExpr,IExpr> |
collect(java.util.Collection<? super IExpr> resultCollection) |
static java.util.function.Function<IExpr,IExpr> |
constant(IExpr expr)
Return a function which returns the given expression in the
apply() method. |
static java.util.function.Function<IExpr,IExpr> |
evalArg(IAST ast,
int position,
EvalEngine engine)
Create a functor which evaluates the given
ast as a function
with the argument at the given position replaced in the
apply() method. |
static java.util.function.Function<IExpr,IExpr> |
replace1st(IAST ast)
Deprecated.
use
replaceArg(IAST, int) instead |
static java.util.function.Function<IExpr,IExpr> |
replace2nd(IAST ast)
Deprecated.
use
replaceArg(IAST, int) instead |
static java.util.function.Function<IExpr,IExpr> |
replaceAll(IAST ast,
IExpr lhs)
Create a functor, which replaces all (sub-)expressions in
ast which equals lhs with the argument of the
functors apply() method. |
static java.util.function.Function<IExpr,IExpr> |
replaceArg(IAST ast,
int position)
Create a functor, which replaces the argument at the given position in
the
ast with the argument of the functors
apply() method. |
static java.util.function.Function<IExpr,IExpr> |
rules(IAST astRules)
Create a functor from the given rules.
|
static java.util.function.Function<IExpr,IExpr> |
rules(java.util.Map<? extends IExpr,? extends IExpr> rulesMap)
Create a functor from the given map, which calls the
rulesMap.get() in the functors applymethod. |
static java.util.function.Function<IExpr,IExpr> |
rules(java.lang.String[] strRules)
Create a functor from the given rules.
|
static java.util.function.Function<IExpr,IExpr> |
scan(IAST ast,
java.util.Collection<? super IExpr> resultCollection)
Return a function which clones the given AST and appends the argument to
the cloned AST in the
apply() method. |
public static java.util.function.Function<IExpr,IExpr> scan(IAST ast, java.util.Collection<? super IExpr> resultCollection)
apply() method. The clone is then
appended to the result collection.ast - the AST which should be cloned and appended to in the
apply methodresultCollection - the collection to which the cloned AST will be appendedpublic static java.util.function.Function<IExpr,IExpr> append(IAST ast)
apply() method.ast - the AST which should be cloned in the apply methodpublic static java.util.function.Function<IExpr,IExpr> evalArg(IAST ast, int position, EvalEngine engine)
ast as a function
with the argument at the given position replaced in the
apply() method.ast - the function which should be evaluatedposition - the position at which the argument should be replacedengine - the current evaluation enginepublic static java.util.function.Function<IExpr,IExpr> apply(IExpr expr)
expr. expr is
typically a symbol.expr - public static java.util.function.Function<IExpr,IExpr> collect(java.util.Collection<? super IExpr> resultCollection)
public static java.util.function.Function<IExpr,IExpr> constant(IExpr expr)
apply() method.expr - public static java.util.function.Function<IExpr,IExpr> replaceAll(IAST ast, IExpr lhs)
ast which equals lhs with the argument of the
functors apply() method.ast - an AST which contains the lhs as a placeholder in
it's subexpressions.lhs - left-hand-side of a Rule(lhs,...)public static java.util.function.Function<IExpr,IExpr> replace1st(IAST ast)
replaceArg(IAST, int) insteadast with the argument of the functors
apply() method.ast - an AST where the first argument is replaced with the argument
of the functors apply() method.public static java.util.function.Function<IExpr,IExpr> replace2nd(IAST ast)
replaceArg(IAST, int) insteadast with the argument of the functors
apply() method.ast - an AST where the second argument is replaced with the argument
of the functors apply() method.public static java.util.function.Function<IExpr,IExpr> replaceArg(IAST ast, int position)
ast with the argument of the functors
apply() method.ast - an AST where the element at the given position is
replaced with the argument of the functors
apply() method.position - the position of the element, which should be replaced in the
ast.public static java.util.function.Function<IExpr,IExpr> rules(java.util.Map<? extends IExpr,? extends IExpr> rulesMap)
rulesMap.get() in the functors applymethod.rulesMap - public static java.util.function.Function<IExpr,IExpr> rules(java.lang.String[] strRules) throws WrongArgumentType
strRules are parsed in internal rules form.strRules - array of rules of the form "x->y"WrongArgumentTypepublic static java.util.function.Function<IExpr,IExpr> rules(IAST astRules) throws WrongArgumentType
astRules is a
List[] object, the elements of the list are taken as the
rules of the form Rule[lhs, rhs], otherwise the
astRules itself is taken as the Rule[lhs, rhs].astRules - WrongArgumentType