org.lsmp.djep.matrixJep.function
Class MDiff
java.lang.Object
org.nfunk.jep.function.PostfixMathCommand
org.lsmp.djep.matrixJep.function.MDiff
- All Implemented Interfaces:
- SpecialPreProcessorI, PostfixMathCommandI
public class MDiff
- extends PostfixMathCommand
- implements SpecialPreProcessorI
- Author:
- Rich Morris
Created on 14-Feb-2005
|
Constructor Summary |
MDiff()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MDiff
public MDiff()
preprocess
public MatrixNodeI preprocess(ASTFunNode node,
MatrixPreprocessor visitor,
MatrixJep jep,
MatrixNodeFactory nf)
throws ParseException
- Description copied from interface:
SpecialPreProcessorI
- Subverts the preprocessing stage.
Preprocessing performs a number of operations:
- Converts each node into one of the subtypes of MatrixNodeI
- Calculate the dimensions for the results
- Performs any special symbolic operations such as differentation
In general the first step in preprocessing is to run the preprocessor on the children of the node.
This can be done using
MatrixNodeI children[] = visitor.visitChildrenAsArray(node,null);
The final step is to construct a node of the correct type. The MatrixNodeFactory
argument has a number of methods to do this. For example
return (ASTMFunNode) nf.buildOperatorNode(node.getOperator(),children,rhsDim);
Note how the dimension is specified.
- Specified by:
preprocess in interface SpecialPreProcessorI
- Parameters:
node - the top node of the tree representing the function and its arguments.visitor - A reference to the preprocessing visitor.jep - A reference of the MatrixJep instance.nf - A reference to the node factory object.
- Returns:
- A new MatrixNodeI representing the converted function.
- Throws:
ParseException - if some error occurs.
Copyright © 2014. All rights reserved.