org.jscience.io.mathml
Class MathMLExpression

java.lang.Object
  extended by org.jscience.io.mathml.MathMLExpression

public final class MathMLExpression
extends java.lang.Object

The MathMLExpression class is used by the MathMLParser to encapsulate math expressions described by the <apply> tag.


Constructor Summary
MathMLExpression()
          Constructs a MathML expression.
 
Method Summary
 void addArgument(java.lang.Object obj)
          Adds an argument to this expression.
 java.lang.Object evaluate()
          Evaluates this expression.
 java.lang.Object getArgument(int n)
          Returns an argument from this expression.
 java.lang.String getOperation()
          Returns the operation to be applied to the arguments.
 int length()
          Returns the number of arguments.
 void setOperation(java.lang.String op)
          Set the operation to be applied to the arguments.
 MathMLExpression substitute(java.util.Map vars)
          Substitutes several values for variables in this expression.
 MathMLExpression substitute(java.lang.String var, java.lang.Object value)
          Substitutes a value for a variable in this expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathMLExpression

public MathMLExpression()
Constructs a MathML expression.

Method Detail

setOperation

public void setOperation(java.lang.String op)
Set the operation to be applied to the arguments.

Parameters:
op - a MathML tag name (plus, minus, times, divide, etc).

getOperation

public java.lang.String getOperation()
Returns the operation to be applied to the arguments.

Returns:
a MathML tag name.

addArgument

public void addArgument(java.lang.Object obj)
Adds an argument to this expression.

Parameters:
obj - DOCUMENT ME!

getArgument

public java.lang.Object getArgument(int n)
Returns an argument from this expression.

Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!

length

public int length()
Returns the number of arguments.

Returns:
DOCUMENT ME!

substitute

public MathMLExpression substitute(java.lang.String var,
                                   java.lang.Object value)
Substitutes a value for a variable in this expression.

Parameters:
var - the variable to substitute for.
value - the value of the variable.
Returns:
the expression after substitution.

substitute

public MathMLExpression substitute(java.util.Map vars)
Substitutes several values for variables in this expression.

Parameters:
vars - a hashtable of variables and values to substitute.
Returns:
the expression after substitution.

evaluate

public java.lang.Object evaluate()
Evaluates this expression.

Returns:
DOCUMENT ME!