org.lsmp.djep.rewrite
Class RewriteVisitor

java.lang.Object
  extended by org.lsmp.djep.xjep.DoNothingVisitor
      extended by org.lsmp.djep.rewrite.RewriteVisitor
All Implemented Interfaces:
ParserVisitor

public class RewriteVisitor
extends DoNothingVisitor

Simplifies an expression. To use

 JEP j = ...; Node in = ...;
 SimplificationVisitor sv = new SimplificationVisitor(tu);
 Node out = sv.simplify(in);
 

Its intended to completely rewrite this class to that simplification rules can be specified by strings in a way similar to DiffRulesI. It also would be nice to change the rules depending on the type of arguments, for example matrix multiplication is not commutative. But some of the in built rules exploit commutativity.

Author:
Rich Morris Created on 20-Jun-2003

Constructor Summary
RewriteVisitor()
           
 
Method Summary
 Node rewrite(Node node, XJep xjep, RewriteRuleI[] inrules, boolean simplify)
          must be implemented for subclasses.
 java.lang.Object visit(ASTFunNode node, java.lang.Object data)
           
 
Methods inherited from class org.lsmp.djep.xjep.DoNothingVisitor
acceptChildrenAsArray, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RewriteVisitor

public RewriteVisitor()
Method Detail

rewrite

public Node rewrite(Node node,
                    XJep xjep,
                    RewriteRuleI[] inrules,
                    boolean simplify)
             throws ParseException,
                    java.lang.IllegalArgumentException
must be implemented for subclasses.

Throws:
ParseException
java.lang.IllegalArgumentException

visit

public java.lang.Object visit(ASTFunNode node,
                              java.lang.Object data)
                       throws ParseException
Specified by:
visit in interface ParserVisitor
Overrides:
visit in class DoNothingVisitor
Throws:
ParseException


http://www.singularsys.com/jep Copyright © 2007 Singular Systems