Class AbstrctPolynomialRewriter
java.lang.Object
com.singularsys.extensions.polynomials.AbstrctPolynomialRewriter
- Direct Known Subclasses:
ComplexPolynomialRewriter
A base class for polynomial rewriters.
The default implementation
calls the rewrite method for each node,
and returns a copy of the original.
- Since:
- Jep 4.1, extension 2.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PNodeIRewrite a monomial.protected PNodeIRewrite a mutable monomial.protected PNodeIRewrite a mutable polynomial.protected PConstantRewrite a constant.protected PNodeIRewrite a function.Rewrite a node.protected PNodeIRewrite a polynomial.protected PNodeIRewrite an operator.protected PNodeIRewrite a variable.
-
Constructor Details
-
AbstrctPolynomialRewriter
-
-
Method Details
-
rewrite
Rewrite a node. The default implementation calls the rewrite method for each node type, and returns a copy of the original.- Parameters:
node- the node to rewrite- Returns:
- a new node
- Throws:
ParseException
-
rewrite
Rewrite a function. The default implementation creates a new PFunction with the same name and pfmc, but with the arguments rewritten.- Parameters:
fun- the function to rewrite- Returns:
- a new PFunction
- Throws:
ParseException
-
rewrite
Rewrite a constant. The default implementation returns a new constant with the same value.- Parameters:
c- the constant to rewrite- Returns:
- the same constant
- Throws:
ParseException
-
rewrite
Rewrite a monomial. The default implementation creates a newMutableMonomialwith the rewritten of the coefficient, variables and powers. The new monomial is then rewritten using therewrite(MutableMonomial)method.- Parameters:
m- the monomial to rewrite- Returns:
- a new monomial
- Throws:
ParseException
-
rewrite
Rewrite a mutable monomial. The default implementation simply returnsmm.toNode()creating new monomial with the same coefficient, variables and powers.- Parameters:
mm- the mutable monomial to rewrite- Returns:
- a new monomial
- Throws:
ParseException
-
rewrite
Rewrite an operator. The default implementation returns the same operator.- Parameters:
op- the operator to rewrite- Returns:
- the same operator
- Throws:
ParseException
-
rewrite
Rewrite a variable. The default implementation creates a new PVariable with the same Jep variable.- Parameters:
v- the variable to rewrite- Returns:
- the same variable
- Throws:
ParseException
-
rewrite
Rewrite a polynomial. The default implementation creates a newMutablePolynomialwith rewritten versions of each terms. The new polynomial is then rewritten using therewrite(MutablePolynomial)method.- Parameters:
p- the polynomial to rewrite- Returns:
- a new polynomial
- Throws:
ParseException
-
rewrite
Rewrite a mutable polynomial. The default implementation simply returnsmp.toNode()creating new polynomial with the same terms.- Parameters:
mp- the mutable polynomial to rewrite- Returns:
- a new polynomial
- Throws:
ParseException
-