org.activemath.exercises.model
Class OMUtility

java.lang.Object
  extended by org.activemath.exercises.model.OMUtility

public class OMUtility
extends Object


Constructor Summary
OMUtility()
           
 
Method Summary
static boolean isNumericallyEqual(org.jdom.Element a, org.jdom.Element b, double epsilon)
           
static boolean isSemanticallyEqual(org.jdom.Element a, org.jdom.Element b)
           
static boolean isSyntacticallyEqual(org.jdom.Element a, org.jdom.Element b)
          Compare two elements syntactically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OMUtility

public OMUtility()
Method Detail

isSyntacticallyEqual

public static boolean isSyntacticallyEqual(org.jdom.Element a,
                                           org.jdom.Element b)
Compare two elements syntactically. This is done by recursively matching all subelements and attributes defined in OpenMath. Extra elements or attributes are ignored. If any of the elements is null, the result is "false". OM errors are treated specially: if the head symbol matches, they are considered equivalent regardless of the rest. This allows to match an error class ignoring the accompanying context information.

Parameters:
a - first element.
b - second element.
Returns:
true if equal, false otherwise.

isSemanticallyEqual

public static boolean isSemanticallyEqual(org.jdom.Element a,
                                          org.jdom.Element b)

isNumericallyEqual

public static boolean isNumericallyEqual(org.jdom.Element a,
                                         org.jdom.Element b,
                                         double epsilon)