// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) space 
// Source File Name:   OperatorNode.java

package lt.monarch.function.node;

import lt.monarch.function.Node;

// Referenced classes of package lt.monarch.function.node:
//            AbstractNode, ConstantNode

public abstract class OperatorNode extends AbstractNode
{

    public void visited(lt.monarch.function.Node.Visitor visitor)
    {
        super.visited(visitor);
        l.visited(visitor);
        r.visited(visitor);
    }

    public Node simplifyOperation()
    {
        if ((l instanceof ConstantNode) && (r instanceof ConstantNode))
            return (Node)new ConstantNode(evaluate());
        else
            return (Node)this;
    }

    public Node simplify()
    {
        l = l.simplify();
        r = r.simplify();
        return simplifyOperation();
    }

    public boolean equals(Object obj)
    {
        if (!super.equals(obj))
        {
            return false;
        } else
        {
            OperatorNode operatornode = (OperatorNode)obj;
            return l.equals(operatornode.l) && r.equals(operatornode.r);
        }
    }

    public abstract double evaluate();

    public abstract Node cloneNode();

    public OperatorNode(Node node, Node node1)
    {
        l = node;
        r = node1;
    }

    protected Node l;
    protected Node r;
}
