org.lsmp.djep.matrixJep
Class MatrixNodeFactory

java.lang.Object
  extended by org.lsmp.djep.xjep.NodeFactory
      extended by org.lsmp.djep.matrixJep.MatrixNodeFactory

public class MatrixNodeFactory
extends NodeFactory

This class is used to create nodes of specified types. It can be sub-classed to change the nature of how nodes are constructed. Generally there are two methods for creating nodes, methods which take an existing node and methods which take the components.

Author:
Rich Morris Created on 16-Nov-2003

Constructor Summary
MatrixNodeFactory(XJep xj)
           
 
Method Summary
 ASTConstant buildConstantNode(java.lang.Object value)
          Creates an ASTConstant node with specified value.
 ASTFunNode buildFunctionNode(ASTFunNode node, Node[] children)
          Builds a function with n arguments
 ASTFunNode buildFunctionNode(ASTFunNode node, Node[] arguments, Dimensions dim)
          create a function node with a known dimension
 ASTFunNode buildFunctionNode(java.lang.String name, PostfixMathCommandI pfmc, Node[] arguments)
          Builds a function with n arguments
 ASTFunNode buildOperatorNode(Operator op, Node[] arguments)
          Builds a operator node with n arguments
 ASTFunNode buildOperatorNode(Operator op, Node[] arguments, Dimensions dim)
          create a function node with a known dimension
 ASTFunNode buildUnfinishedOperatorNode(Operator op)
          Creates an operator node, but don't fill in the children or calculate its dimension.
 ASTVarNode buildVariableNode(Variable var)
          Creates a ASTVariable node with specified value.
 Dimensions calcDim(Operator op, Node[] arguments)
          Calculates the dimension of node using the dimensions of the children.
 Dimensions calcDim(java.lang.String name, PostfixMathCommandI pfmc, Node[] arguments)
          Calculates the dimension of node using the dimensions of the children.
 
Methods inherited from class org.lsmp.djep.xjep.NodeFactory
buildConstantNode, buildConstantNode, buildConstantNode, buildConstantNode, buildConstantNode, buildOperatorNode, buildOperatorNode, buildVariableNode, buildVariableNode, copyChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixNodeFactory

public MatrixNodeFactory(XJep xj)
Method Detail

buildConstantNode

public ASTConstant buildConstantNode(java.lang.Object value)
                              throws ParseException
Creates an ASTConstant node with specified value.

Overrides:
buildConstantNode in class NodeFactory
Throws:
ParseException

buildVariableNode

public ASTVarNode buildVariableNode(Variable var)
                             throws ParseException
Creates a ASTVariable node with specified value.

Overrides:
buildVariableNode in class NodeFactory
Throws:
ParseException

buildFunctionNode

public ASTFunNode buildFunctionNode(java.lang.String name,
                                    PostfixMathCommandI pfmc,
                                    Node[] arguments)
                             throws ParseException
Builds a function with n arguments

Overrides:
buildFunctionNode in class NodeFactory
Parameters:
name - of function.
pfmc - PostfixMathCommand for function.
arguments - the arguments to the function.
Returns:
top Node of expression
Throws:
ParseException

calcDim

public Dimensions calcDim(java.lang.String name,
                          PostfixMathCommandI pfmc,
                          Node[] arguments)
                   throws ParseException
Calculates the dimension of node using the dimensions of the children. Does not recurse down the tree.

Throws:
ParseException

calcDim

public Dimensions calcDim(Operator op,
                          Node[] arguments)
                   throws ParseException
Calculates the dimension of node using the dimensions of the children.

Throws:
ParseException

buildFunctionNode

public ASTFunNode buildFunctionNode(ASTFunNode node,
                                    Node[] children)
                             throws ParseException
Builds a function with n arguments

Overrides:
buildFunctionNode in class NodeFactory
Parameters:
node - the properties (name and pfmc) of this node will be copied.
children - the arguments to the function.
Returns:
top Node of expression
Throws:
ParseException
Since:
2.3.3 if possible use dimension of existing node. (Needed when deep copying MList functions)

buildFunctionNode

public ASTFunNode buildFunctionNode(ASTFunNode node,
                                    Node[] arguments,
                                    Dimensions dim)
create a function node with a known dimension


buildOperatorNode

public ASTFunNode buildOperatorNode(Operator op,
                                    Node[] arguments)
                             throws ParseException
Builds a operator node with n arguments

Overrides:
buildOperatorNode in class NodeFactory
Parameters:
op - the operator for this node
arguments - the arguments to the function.
Returns:
top Node of expression
Throws:
ParseException

buildOperatorNode

public ASTFunNode buildOperatorNode(Operator op,
                                    Node[] arguments,
                                    Dimensions dim)
create a function node with a known dimension


buildUnfinishedOperatorNode

public ASTFunNode buildUnfinishedOperatorNode(Operator op)
Creates an operator node, but don't fill in the children or calculate its dimension.

Overrides:
buildUnfinishedOperatorNode in class NodeFactory


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