1 8 package org.lsmp.djep.djep; 9 import org.nfunk.jep.*; 10 import org.lsmp.djep.xjep.*; 11 12 import java.util.Observable ; 13 import java.util.Observer ; 14 20 public class PartialDerivative extends XVariable implements Observer { 21 22 private DVariable root; 23 private String dnames[] = null; 24 private String printString; 25 29 protected PartialDerivative(DVariable var, String derivnames[],Node deriv) 30 { 31 super(var.getName()); 32 root = var; 33 dnames = derivnames; 34 setEquation(deriv); 35 printString = DVariable.makeDerivString(root.getName(),derivnames); 36 root.addObserver(this); 37 } 38 39 public String getName() { return printString; } 40 41 46 public DVariable getRoot() { return root; } 47 public String [] getDnames() { return dnames; } 48 49 public String toString() 50 { 51 return printString; 52 } 53 54 public PartialDerivative findDerivative(String name,DJep jep) 55 throws ParseException 56 { 57 return root.findDerivative(this,name,jep); 58 } 59 60 61 67 public void update(Observable arg0, Object arg1) { 68 if(root.equals(arg0)) 69 { 70 setValidValue(false); 71 } 72 } 73 74 } 75 | Popular Tags |