KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > tests > jfun > parsec > mssql > FunctionCall


1 /*
2  * Created on 2004-11-15
3  *
4  * Author Ben Yu
5  */

6 package tests.jfun.parsec.mssql;
7
8 /**
9  * @author Ben Yu
10  *
11  * 2004-11-15
12  */

13 public final class FunctionCall implements Expression {
14
15   /*
16    * @see jfun.parsec.mssql.Expression#getPrecedence()
17    */

18   public int getPrecedence() {
19     return Precedences.function_call();
20   }
21
22   /*
23    * @see jfun.parsec.mssql.Expression#acceptVisitor(jfun.parsec.mssql.ExpressionVisitor)
24    */

25   public void acceptVisitor(ExpressionVisitor v) {
26     v.visitFunctionCall(name, args);
27   }
28   private final QualifiedName name;
29   private final Expression[] args;
30   
31   /**
32    * @param name
33    * @param args
34    */

35   FunctionCall(final QualifiedName name, final Expression[] args) {
36     this.name = name;
37     this.args = args;
38   }
39   public String JavaDoc toString(){
40     final StringBuffer JavaDoc buf = new StringBuffer JavaDoc(name.toString());
41     buf.append('(');
42     if(args.length >= 1)
43       buf.append(args[0]);
44     for(int i=1; i<args.length; i++)
45       buf.append(", ").append(args[i]);
46     buf.append(')');
47     return buf.toString();
48   }
49 }
50
Popular Tags