Class CollectPowers
- java.lang.Object
-
- com.singularsys.extensions.rewrite.AbstractRewrite
-
- com.singularsys.extensions.rewrite.CollectPowers
-
- All Implemented Interfaces:
RewriteRuleI
,JepComponent
,java.io.Serializable
public class CollectPowers extends AbstractRewrite
Collect powers together so thatx*x -> x^2
andx^n*x -> x^(n+1)
.- Author:
- Rich Morris Created on 06-Oct-2004
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CollectPowers()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
apply(ASTFunNode node, Node[] children)
Rewrites the nodeboolean
test(ASTFunNode node, Node[] children)
Returns true if node needs to be rewritten, according to this rule.-
Methods inherited from class com.singularsys.extensions.rewrite.AbstractRewrite
getLightWeightInstance, init
-
-
-
-
Method Detail
-
test
public boolean test(ASTFunNode node, Node[] children)
Description copied from interface:RewriteRuleI
Returns true if node needs to be rewritten, according to this rule.
-
apply
public Node apply(ASTFunNode node, Node[] children) throws ParseException
Description copied from interface:RewriteRuleI
Rewrites the node- Throws:
ParseException
-
-