org.lsmp.djep.djep
Class DVariable

java.lang.Object
  extended by java.util.Observable
      extended by org.nfunk.jep.Variable
          extended by org.lsmp.djep.xjep.XVariable
              extended by org.lsmp.djep.djep.DVariable
Direct Known Subclasses:
MatrixVariable

public class DVariable
extends XVariable

Holds all info about a variable. Has a name, an equation, a dimension (or sent of dimensions if matrix or tensor) and also a set of PartialDerivative. The derivatives are stored in a hashtable index by the sorted names of derivatives. i.e. d^2f/dxdy, and d^2f/dydx will both be indexed by {"x","y"}. df/dx is indexed by {"x"}, d^2f/dx^2 is index by {"x","x"}. Partial derivatives are calculated as required by the findDerivative method.

Author:
Rich Morris Created on 26-Oct-2003

Field Summary
protected  java.util.Hashtable derivatives
           
 
Fields inherited from class org.nfunk.jep.Variable
name
 
Constructor Summary
protected DVariable(java.lang.String name)
          The constructor is package private.
protected DVariable(java.lang.String name, java.lang.Object value)
           
 
Method Summary
 java.util.Enumeration allDerivatives()
          Enumerate all the derivatives of this variable.
protected  PartialDerivative createDerivative(java.lang.String[] derivnames, Node eqn)
           
 void invalidateAll()
          makes value and values of all derivatives invalid.
static java.lang.String makeDerivString(java.lang.String rootname, java.lang.String[] dnames)
          Produces a string to represent the derivative.
 void setEquation(Node eqn)
          sets the equation
 java.lang.String toString(PrintVisitor bpv)
          Returns a string rep of variable with its equation and value.
 
Methods inherited from class org.lsmp.djep.xjep.XVariable
calcValue, getEquation, hasEquation
 
Methods inherited from class org.nfunk.jep.Variable
getName, getValue, hasValidValue, isConstant, setIsConstant, setValidValue, setValue, setValueRaw, toString
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

derivatives

protected java.util.Hashtable derivatives
Constructor Detail

DVariable

protected DVariable(java.lang.String name)
The constructor is package private. Variables should be created using the VariableTable.find(Sting name) method.


DVariable

protected DVariable(java.lang.String name,
                    java.lang.Object value)
Method Detail

createDerivative

protected PartialDerivative createDerivative(java.lang.String[] derivnames,
                                             Node eqn)

setEquation

public void setEquation(Node eqn)
sets the equation

Overrides:
setEquation in class XVariable

invalidateAll

public void invalidateAll()
makes value and values of all derivatives invalid.


makeDerivString

public static java.lang.String makeDerivString(java.lang.String rootname,
                                               java.lang.String[] dnames)
Produces a string to represent the derivative. The string will be of the form "dx^2/dxdy". This string is used to index the derivatives of a variable.

Parameters:
rootname - name of the variable we are calculating the derivative of.
dnames - An array of the names of each of the partial derivatives.
Returns:
the string representation

toString

public java.lang.String toString(PrintVisitor bpv)
Description copied from class: XVariable
Returns a string rep of variable with its equation and value.

Overrides:
toString in class XVariable

allDerivatives

public java.util.Enumeration allDerivatives()
Enumerate all the derivatives of this variable.

Returns:
an Enumeration running through all the derivatives.


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