Documentation of 'org.matheclipse.core.generic.Functors' Java class
Functors
org.matheclipse.core.generic

Class Functors



  • public class Functors
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static 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 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 Function<IExpr,IExpr> collect(java.util.Collection<? super IExpr> resultCollection) 
      static Function<IExpr,IExpr> constant(IExpr expr)
      Return a function which returns the given expression in the apply() method.
      static 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 Function<IExpr,IExpr> replace1st(IAST ast)
      Create a functor, which replaces the argument at the first position in the ast with the argument of the functors apply() method.
      static Function<IExpr,IExpr> replace2nd(IAST ast)
      Create a functor, which replaces the argument at the second position in the ast with the argument of the functors apply() method.
      static 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 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 Function<IExpr,IExpr> rules(IAST astRules)
      Create a functor from the given rules.
      static 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 Function<IExpr,IExpr> rules(java.lang.String[] strRules)
      Create a functor from the given rules.
      static 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • scan

        public static Function<IExpr,IExpr> scan(@Nonnull
                                                 IAST ast,
                                                 @Nonnull
                                                 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. The clone is then appended to the result collection.
        Parameters:
        ast - the AST which should be cloned and appended to in the apply method
        resultCollection - the collection to which the cloned AST will be appended
        Returns:
      • append

        public static Function<IExpr,IExpr> append(@Nonnull
                                                   IAST ast)
        Return a function which clones the given AST and appends the argument to the cloned AST in the apply() method.
        Parameters:
        ast - the AST which should be cloned in the apply method
        Returns:
      • evalArg

        public static Function<IExpr,IExpr> evalArg(@Nonnull
                                                    IAST ast,
                                                    int position,
                                                    @Nonnull
                                                    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.
        Parameters:
        ast - the function which should be evaluated
        position - the position at which the argument should be replaced
        engine - the current evaluation engine
        Returns:
      • apply

        public static Function<IExpr,IExpr> apply(@Nonnull
                                                  IExpr expr)
        Return a function which clones the argument, if it is of type AST and sets the header to the given expr. expr is typically a symbol.
        Parameters:
        expr -
        Returns:
      • collect

        public static Function<IExpr,IExpr> collect(@Nonnull
                                                    java.util.Collection<? super IExpr> resultCollection)
      • constant

        public static Function<IExpr,IExpr> constant(@Nonnull
                                                     IExpr expr)
        Return a function which returns the given expression in the apply() method.
        Parameters:
        expr -
        Returns:
      • replaceAll

        public static Function<IExpr,IExpr> replaceAll(@Nonnull
                                                       IAST ast,
                                                       @Nonnull
                                                       IExpr lhs)
        Create a functor, which replaces all (sub-)expressions in ast which equals lhs with the argument of the functors apply() method.
        Parameters:
        ast - an AST which contains the lhs as a placeholder in it's subexpressions.
        lhs - left-hand-side of a Rule(lhs,...)
        Returns:
      • replace1st

        public static Function<IExpr,IExpr> replace1st(@Nonnull
                                                       IAST ast)
        Create a functor, which replaces the argument at the first position in the ast with the argument of the functors apply() method.
        Parameters:
        ast - an AST where the first argument is replaced with the argument of the functors apply() method.
        Returns:
      • replace2nd

        public static Function<IExpr,IExpr> replace2nd(@Nonnull
                                                       IAST ast)
        Create a functor, which replaces the argument at the second position in the ast with the argument of the functors apply() method.
        Parameters:
        ast - an AST where the second argument is replaced with the argument of the functors apply() method.
        Returns:
      • replaceArg

        public static Function<IExpr,IExpr> replaceArg(@Nonnull
                                                       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.
        Parameters:
        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.
        Returns:
      • rules

        public static 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.
        Parameters:
        rulesMap -
        Returns:
      • rules

        public static Function<IExpr,IExpr> rules(@Nonnull
                                                  java.lang.String[] strRules)
                                           throws WrongArgumentType
        Create a functor from the given rules. All strings in strRules are parsed in internal rules form.
        Parameters:
        strRules - array of rules of the form "x->y"
        Returns:
        Throws:
        WrongArgumentType
      • rules

        public static Function<IExpr,IExpr> rules(@Nonnull
                                                  IAST astRules)
                                           throws WrongArgumentType
        Create a functor from the given rules. If 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].
        Parameters:
        astRules -
        Returns:
        Throws:
        WrongArgumentType

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.