org.lsmp.djep.vectorJep
Class VectorJep

java.lang.Object
  extended by org.nfunk.jep.JEP
      extended by org.lsmp.djep.vectorJep.VectorJep

public class VectorJep
extends JEP

An extension of JEP with support for basic vectors and matrices. Use this class instead of JEP if you wish to use vectors and matrices.

Author:
Rich Morris Created on 19-Dec-2003

Field Summary
 
Fields inherited from class org.nfunk.jep.JEP
allowAssignment, allowUndeclared, errorList, ev, funTab, implicitMul, numberFactory, opSet, parser, symTab
 
Constructor Summary
VectorJep()
           
VectorJep(JEP j)
           
 
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.
 void setElementMultiply(boolean value)
          When set the multiplication of vectors and matrices will be element by element.
 
Methods inherited from class org.nfunk.jep.JEP
addComplex, addConstant, addFunction, addStandardConstants, addVariable, addVariable, addVariable, getAllowAssignment, getAllowUndeclared, getComplexValue, getErrorInfo, getEvaluatorVisitor, getFunctionTable, getImplicitMul, getNumberFactory, getOperatorSet, getParser, getSymbolTable, getTopNode, getTraverse, getValue, getValueAsObject, 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
 

Constructor Detail

VectorJep

public VectorJep()

VectorJep

public VectorJep(JEP j)
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 JEP

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 java.lang.Exception
Evaluate a node. Does not unwrap scalers.

Throws:
java.lang.Exception

setElementMultiply

public void setElementMultiply(boolean value)
When set the multiplication of vectors and matrices will be element by element. Otherwise multiplication will be matrix multiplication (the default).



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