All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lsmp.djep.xjep.DoNothingVisitor Maven / Gradle / Ivy

Go to download

JEP is a Java library for parsing and evaluating mathematical expressions.

There is a newer version: 2.4.2
Show newest version
/* @author rich
 * Created on 16-Nov-2003
 */
package org.lsmp.djep.xjep;

import org.nfunk.jep.*;

/**
 * A Visitor which visits each node of a expression tree.
 * It returns the top node.
 * This visitor should be extended by Visitors which modify trees in place.
 * 
 * @author Rich Morris
 * Created on 16-Nov-2003
 */
public abstract class DoNothingVisitor implements ParserVisitor {

	/*
	 * The following methods was used to facilitate 
	 * using visitors which implemented a interface
	 * which subclassed ParserVisitor.
	 *  
	 * If subclassed to extend to implement a different visitor
	 * this method should be overwritten to ensure the correct 
	 * accept method is called.
	 * This method simply calls the jjtAccept(ParserVisitor this,Object data) of node.
	 *
	 * We no longer need this as we use ParseVisitor everywhere,
	 * but kept for future reference.
	 * 
	private Object nodeAccept(Node node, Object data) throws ParseException
	{
		return node.jjtAccept(this,data);
	}
	*/
	
	/**
	 * Gets the result of visiting children of a array of nodes.
	 */
	
	protected Node[] acceptChildrenAsArray(Node node,Object data)  throws ParseException
	{
		int n = node.jjtGetNumChildren();
		Node children[] = new Node[n];
		for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy