/*
 * VariableNode.java
 *
 * Created on 2. prosinec 2005, 18:42
 *
 * 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 VariableNode extends Node {
    String value;
    /** Creates a new instance of VariableNode */
    public VariableNode(String v) {
        this.value = v;
    }
    
    public String getName(){
        return value;
    }
    
    public double evaluate(double varValue, String varName) {
        if(varName.equalsIgnoreCase(value)) {
            return varValue;
        }else return 0;
    }
    
  
    
    public String print(int priority) {
        return this.value;
    }
    
    public String printSyntax(int priority) {
         return Operations.getColoredText(Color.magenta, String.valueOf(this.value));
    }
    
    
}
