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

org.lsmp.djep.sjep.POperator 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-Dec-2004
 */
package org.lsmp.djep.sjep;
import org.lsmp.djep.xjep.*;
import org.nfunk.jep.Node;
import org.nfunk.jep.ParseException;

/**
 * Represents an operator.
 * 
 * @author Rich Morris
 * Created on 16-Dec-2004
 */
public class POperator extends AbstractPNode {
	XOperator op;
	PNodeI args[];
	public POperator(PolynomialCreator pc,XOperator op,PNodeI[] args) {
		super(pc);
		this.op = op;
		this.args = args;
	}
	
	public boolean equals(PNodeI node)
	{
		if(!(node instanceof POperator)) return false;
		POperator nodeOp = (POperator) node;
		if(!this.op.equals(nodeOp)) return false;
		if(args.length != nodeOp.args.length)
			return false;
		for(int i=0;i -1
	this > arg ---> 1
	*/
	public int compareTo(POperator fun)
	{
		int res = op.getName().compareTo(op.getName());
		if(res != 0) return res;
		
		if(args.length < fun.args.length) return -1;
		if(args.length > fun.args.length) return 1;
		
		for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy