KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nfunk > jep > ASTVarNode


1 /*****************************************************************************
2
3 JEP - Java Math Expression Parser 2.3.0
4       October 3 2004
5       (c) Copyright 2004, Nathan Funk and Richard Morris
6       See LICENSE.txt for license information.
7
8 *****************************************************************************/

9 /* Generated By:JJTree: Do not edit this line. ASTVarNode.java */
10
11 package org.nfunk.jep;
12
13 /**
14  * Variable Node
15  */

16 public class ASTVarNode extends SimpleNode {
17     
18     //private String varName;
19
private Variable var;
20     
21     public ASTVarNode(int id) {
22         super(id);
23         var = null;
24     }
25     
26     public ASTVarNode(Parser p, int id) {
27         super(p, id);
28     }
29     
30     /**
31      * Accept the visitor.
32      */

33     public Object JavaDoc jjtAccept(ParserVisitor visitor, Object JavaDoc data) throws ParseException
34     {
35         return visitor.visit(this, data);
36     }
37
38     /**
39      * Sets the name of the variable.
40      */

41     //public void setName(String varName_in)
42
//{
43
// var = varName_in;
44
//}
45
public void setVar(Variable variable) { var = variable; }
46     public Variable getVar() { return var; }
47     
48     /**
49      * Returns the name of the variable.
50      */

51     public String JavaDoc getName()
52     {
53         return var.getName();
54     }
55
56     /**
57     * Creates a string containing the variable's name and value
58     */

59     public String JavaDoc toString()
60     {
61         String JavaDoc temp = "Variable: \"" + getName() + "\"";
62         
63         return temp;
64     }
65 }
66
Popular Tags