org.lsmp.djep.groupJep
Class GroupJep

java.lang.Object
  extended by org.nfunk.jep.JEP
      extended by org.lsmp.djep.groupJep.GroupJep

public class GroupJep
extends JEP

An extension of JEP which allows calculations over arbitary groups, such as the integers(exact answers) and rationals.

Author:
Rich Morris Created on 19-Dec-2003

Field Summary
protected  GroupI group
           
 
Fields inherited from class org.nfunk.jep.JEP
allowAssignment, allowUndeclared, errorList, ev, funTab, implicitMul, numberFactory, opSet, parser, symTab
 
Constructor Summary
GroupJep(GroupI group)
          Create a new GroupJep instance with calculations over the given group.
GroupJep(JEP j)
           
 
Method Summary
 void addStandardConstants()
          Adds the constants pi and e to the parser.
 void addStandardFunctions()
          Adds the standard functions to the parser.
static Complex complexValueOf(java.lang.Object num)
          A utility function which returns the complex aproximation of a number.
 Complex getComplexValue()
          Calcuates the value of the expression and returns the result as a complex number.
 GroupI getGroup()
           
 
Methods inherited from class org.nfunk.jep.JEP
addComplex, addConstant, addFunction, addVariable, addVariable, addVariable, evaluate, getAllowAssignment, getAllowUndeclared, 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
 

Field Detail

group

protected GroupI group
Constructor Detail

GroupJep

public GroupJep(GroupI group)
Create a new GroupJep instance with calculations over the given group.

Parameters:
group - The group to calculate over.

GroupJep

public GroupJep(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

addStandardConstants

public void addStandardConstants()
Description copied from class: JEP
Adds the constants pi and e to the parser. As addStandardFunctions(), this method should be called immediately after the JEP object is created.

Overrides:
addStandardConstants in class JEP

getGroup

public GroupI getGroup()

getComplexValue

public Complex getComplexValue()
Calcuates the value of the expression and returns the result as a complex number.

Overrides:
getComplexValue in class JEP
Returns:
The calculated value of the expression as a complex number if no errors occur. Returns null otherwise.

complexValueOf

public static Complex complexValueOf(java.lang.Object num)
A utility function which returns the complex aproximation of a number.

Parameters:
num - the object to be converted
Returns:
the complex aproximation or null if conversion to complex is not posible.
See Also:
HasComplexValueI


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