org.activemath.exercises.openmath.services
Class CasExpressionEvaluator

java.lang.Object
  extended by org.activemath.exercises.openmath.OpenMathService
      extended by org.activemath.exercises.openmath.services.CasExpressionEvaluator
Direct Known Subclasses:
CasExpressionEvaluatorMaxima, CasExpressionEvaluatorProcess, CasExpressionEvaluatorSocket, CasExpressionEvaluatorWsdl, CasExpressionEvaluatorXmlHttp, CasExpressionEvaluatorXmlRpc

public class CasExpressionEvaluator
extends OpenMathService

CAS expression evaluator OpenMath service. Evaluates OpenMath expressions using an external Computer Algebra System.

Version:
$Revision: 1.22 $ $Date: 2009/07/28 14:21:30 $

Field Summary
 
Fields inherited from class org.activemath.exercises.openmath.OpenMathService
comparatorCD, comparatorName, context, expressionTransformer, om, xpathError, xpathHint, xpathQuit
 
Constructor Summary
protected CasExpressionEvaluator()
           
 
Method Summary
protected static String buildCasExpression(org.jdom.Element omobj, Map variables)
           
protected  org.jdom.Element cas(String expression)
           
 org.jdom.Element evaluate(org.jdom.Element expressionOmobj, Map variables)
          Evaluate the expression, and return its value as the JDom tree of the OpenMath XML with the result.
 boolean evaluateEquivalence(org.jdom.Element a, org.jdom.Element b, Map variables)
          Test whether two expressions are equivalent.
 
Methods inherited from class org.activemath.exercises.openmath.OpenMathService
abort, console, selectContext, setComparator, setExpressionTransformer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CasExpressionEvaluator

protected CasExpressionEvaluator()
Method Detail

evaluate

public org.jdom.Element evaluate(org.jdom.Element expressionOmobj,
                                 Map variables)
Description copied from class: OpenMathService
Evaluate the expression, and return its value as the JDom tree of the OpenMath XML with the result.

Overrides:
evaluate in class OpenMathService
Returns:
OMOBJ element (with OM namespace) containing the value.

evaluateEquivalence

public boolean evaluateEquivalence(org.jdom.Element a,
                                   org.jdom.Element b,
                                   Map variables)
Description copied from class: OpenMathService
Test whether two expressions are equivalent.

Overrides:
evaluateEquivalence in class OpenMathService
Returns:
true if the expressions are equivalent, and false otherwise.

cas

protected org.jdom.Element cas(String expression)

buildCasExpression

protected static String buildCasExpression(org.jdom.Element omobj,
                                           Map variables)