KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > notification > filter > etcl > BoolValue


1 package org.jacorb.notification.filter.etcl;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1999-2004 Gerald Brose
7  *
8  * This library is free software; you can redistribute it and/or modify it under the terms of the
9  * GNU Library General Public License as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
13  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License along with this
17  * library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
18  * USA.
19  *
20  */

21
22 import org.jacorb.notification.filter.EvaluationContext;
23 import org.jacorb.notification.filter.EvaluationException;
24 import org.jacorb.notification.filter.EvaluationResult;
25
26 import antlr.Token;
27
28 public class BoolValue extends AbstractTCLNode
29 {
30
31     boolean value_;
32
33     public BoolValue(Token tok)
34     {
35         super(tok);
36         value_ = tok.getText().equals("TRUE");
37         setName("BoolValue");
38     }
39
40     public EvaluationResult evaluate(EvaluationContext context) throws EvaluationException
41     {
42
43         if (value_)
44         {
45             return EvaluationResult.BOOL_TRUE;
46         }
47
48         return EvaluationResult.BOOL_FALSE;
49     }
50
51     public boolean isStatic()
52     {
53         return true;
54     }
55
56     public boolean isBoolean()
57     {
58         return true;
59     }
60
61     public String JavaDoc toString()
62     {
63         return "" + value_;
64     }
65
66     public void acceptInOrder(AbstractTCLVisitor visitor) throws VisitorException
67     {
68         visitor.visitBool(this);
69     }
70
71     public void acceptPostOrder(AbstractTCLVisitor visitor) throws VisitorException
72     {
73         visitor.visitBool(this);
74     }
75
76     public void acceptPreOrder(AbstractTCLVisitor visitor) throws VisitorException
77     {
78         visitor.visitBool(this);
79     }
80 }
Popular Tags