org.lsmp.djep.sjep.POperator 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.
/* @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