org.lsmp.djep.xjep.NodeFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jep Show documentation
Show all versions of jep Show documentation
JEP is a Java library for parsing and evaluating mathematical expressions. Use groupId org.fudaa to deploy it in maven central
The newest version!
/* @author rich
* Created on 16-Nov-2003
*/
package org.lsmp.djep.xjep;
import org.nfunk.jep.*;
import org.nfunk.jep.function.*;
/**
* 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
*/
public class NodeFactory {
private XJep xj;
public NodeFactory(XJep xj) {this.xj=xj;}
private NodeFactory() {}
/**
* Sets the children of node to be those specified in array.
* @param node the node whose children will be set.
* @param children an array of nodes which will be the children of the node.
*/
public void copyChildren(Node node,Node children[])
{
int nchild = children.length;
node.jjtOpen();
for(int i=0;i