/*
 * UnaryPlus.java
 *
 * Created on 2. prosinec 2005, 18:52
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package cz.pcland.functions.nodes;
import cz.pcland.gavisualization.*;
import java.util.*;
import java.awt.*;
/**
 *
 * @author petr
 */
public class UnaryPlus extends UnaryOperation {
   
    /** Creates a new instance of UnaryPlus */
    public UnaryPlus(Node node) {
        super(node);
    }
    
    public double evaluate(double varValue, String varName) {
        return child.evaluate(varValue, varName);
    }
    
    
    public String print(int priority) {
        return "+" + this.child.print(Priorities.UNARYPLUS);
    }
    
    public String printSyntax(int priority) {
        if(priority > Priorities.UNARYPLUS) {    
           return Operations.getColoredText(Color.ORANGE, "+")+ "(" + this.child.printSyntax(Priorities.UNARYPLUS)+ ")";
        }else {
           return Operations.getColoredText(Color.ORANGE, "+")+ "(" + this.child.printSyntax(Priorities.UNARYPLUS) + ")";
        }
    }
    
}
