org.lsmp.djep.matrixJep
Class MatrixJep

java.lang.Object
  extended by org.nfunk.jep.JEP
      extended by org.lsmp.djep.xjep.XJep
          extended by org.lsmp.djep.djep.DJep
              extended by org.lsmp.djep.matrixJep.MatrixJep

public class MatrixJep
extends DJep

An extension of JEP which allows advanced vector and matrix handling and differentation.

Author:
Rich Morris Created on 19-Dec-2003

Field Summary
protected  MatrixPreprocessor dec
           
protected  MatrixEvaluator mev
           
protected  MatrixVariableFactory mvf
           
 
Fields inherited from class org.lsmp.djep.djep.DJep
dv
 
Fields inherited from class org.lsmp.djep.xjep.XJep
commandv, copier, nf, pv, simpv, subv, tu
 
Fields inherited from class org.nfunk.jep.JEP
allowAssignment, allowUndeclared, errorList, ev, funTab, implicitMul, numberFactory, opSet, parser, symTab
 
Constructor Summary
MatrixJep()
           
 
Method Summary
 void addStandardFunctions()
          Adds the standard functions to the parser.
 java.lang.Object evaluate(Node node)
          Evaluate a node.
 java.lang.Object evaluateRaw(Node node)
          Evaluate a node.
 java.lang.Object getValueAsObject()
          Evaluates and returns the value of the expression as an object.
 Node preprocess(Node node)
          Pre-processes an equation to allow the diff and eval operators to be used.
 
Methods inherited from class org.lsmp.djep.djep.DJep
addDiffRule, addStandardDiffRules, differentiate, getDifferentationVisitor, newInstance, newInstance
 
Methods inherited from class org.lsmp.djep.xjep.XJep
addComplex, addStandardConstants, calcVarValue, continueParsing, deepCopy, evaluate, getNodeFactory, getPrintVisitor, getTreeUtils, getVarsInEquation, print, print, println, println, recursiveGetVarsInEquation, restartParser, restartParser, simplify, substitute, substitute, toString
 
Methods inherited from class org.nfunk.jep.JEP
addConstant, addFunction, addVariable, addVariable, addVariable, getAllowAssignment, getAllowUndeclared, getComplexValue, getErrorInfo, getEvaluatorVisitor, getFunctionTable, getImplicitMul, getNumberFactory, getOperatorSet, getParser, getSymbolTable, getTopNode, getTraverse, getValue, getVar, getVarValue, hasError, initFunTab, initSymTab, parse, parseExpression, removeFunction, removeVariable, setAllowAssignment, setAllowUndeclared, setImplicitMul, setTraverse, setVarValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dec

protected MatrixPreprocessor dec

mvf

protected MatrixVariableFactory mvf

mev

protected MatrixEvaluator mev
Constructor Detail

MatrixJep

public MatrixJep()
Method Detail

addStandardFunctions

public void addStandardFunctions()
Description copied from class: JEP
Adds the standard functions to the parser. If this function is not called before parsing an expression, functions such as sin() or cos() would produce an "Unrecognized function..." error. In most cases, this method should be called immediately after the JEP object is created.

Overrides:
addStandardFunctions in class XJep

evaluate

public java.lang.Object evaluate(Node node)
                          throws ParseException
Evaluate a node. If the result is a scaler it will be unwrapped, i.e. it will return a Double and not a Scaler.

Overrides:
evaluate in class JEP
Parameters:
node - the top node of the tree representing the expression.
Returns:
The value of the expression
Throws:
ParseException - if for some reason the expression could not be evaluated

evaluateRaw

public java.lang.Object evaluateRaw(Node node)
                             throws ParseException
Evaluate a node. Does not unwrap scalers.

Throws:
ParseException

preprocess

public Node preprocess(Node node)
                throws ParseException
Pre-processes an equation to allow the diff and eval operators to be used.

Overrides:
preprocess in class XJep
Throws:
ParseException

getValueAsObject

public java.lang.Object getValueAsObject()
Description copied from class: JEP
Evaluates and returns the value of the expression as an object. The EvaluatorVisitor member ev is used to do the evaluation procedure. This method is useful when the type of the value is unknown, or not important.

Overrides:
getValueAsObject in class JEP
Returns:
The calculated value of the expression if no errors occur. Returns null otherwise.


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