1 8 package org.lsmp.djep.djep; 9 import org.lsmp.djep.xjep.*; 10 import org.nfunk.jep.*; 11 30 public class DJep extends XJep { 31 protected DifferentiationVisitor dv = new DifferentiationVisitor(this); 32 36 public DJep() 37 { 38 this.pv = new DPrintVisitor(); 39 this.symTab = new DSymbolTable(new DVariableFactory()); 41 42 addFunction("diff",new Diff()); 43 } 44 52 public Node differentiate(Node node,String name) throws ParseException 53 { 54 return dv.differentiate(node,name,this); 55 } 56 protected DJep(DJep j) 57 { 58 super((XJep) j); 59 this.dv=j.dv; 60 } 61 62 public XJep newInstance() 63 { 64 DJep newJep = new DJep(this); 65 return newJep; 66 } 67 public XJep newInstance(SymbolTable st) 68 { 69 DJep newJep = new DJep(this); 70 newJep.symTab = st; 71 return newJep; 72 } 73 74 77 public DifferentiationVisitor getDifferentationVisitor() { return dv; } 78 82 public boolean addStandardDiffRules() { return dv.addStandardDiffRules(); } 83 85 89 public void addDiffRule(DiffRulesI rule) { 90 dv.addDiffRule(rule); 91 } 92 93 } 94 | Popular Tags |