KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > Value


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * 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
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.idl;
22
23 /**
24  * @author Gerald Brose
25  * @version $Id: Value.java,v 1.22 2004/05/06 12:39:59 nicolas Exp $
26  */

27
28 import java.io.PrintWriter JavaDoc;
29
30 public class Value
31     extends TypeDeclaration
32 {
33     private Value value;
34
35     public Value( int num )
36     {
37         super( num );
38         pack_name = "";
39     }
40
41     public Object JavaDoc clone()
42     {
43         return value.clone();
44     }
45
46     public void setValue( Value value )
47     {
48         this.value = value;
49     }
50
51     public TypeDeclaration declaration()
52     {
53         return value;
54     };
55
56     public String JavaDoc typeName()
57     {
58         return value.typeName();
59     }
60
61
62     /**
63      * @return a string for an expression of type TypeCode
64      * that describes this type
65      */

66
67     public String JavaDoc getTypeCodeExpression()
68     {
69         return value.getTypeCodeExpression();
70     }
71
72     public boolean basic()
73     {
74         return value.basic();
75     }
76
77     public void setPackage( String JavaDoc s )
78     {
79         s = parser.pack_replace( s );
80         value.setPackage( s );
81     }
82
83     public void set_included( boolean i )
84     {
85         included = i;
86         value.set_included( i );
87     }
88
89     public void parse()
90     {
91         value.parse();
92     }
93
94     public String JavaDoc holderName()
95     {
96         return value.holderName();
97     }
98
99     public void print( PrintWriter JavaDoc ps )
100     {
101         value.print( ps );
102     }
103
104     public String JavaDoc toString()
105     {
106         return value.toString();
107     }
108
109     public void setEnclosingSymbol( IdlSymbol s )
110     {
111         if( enclosing_symbol != null && enclosing_symbol != s )
112         {
113             logger.error("was " + enclosing_symbol.getClass().getName() + " now: " + s.getClass().getName() );
114             throw new RuntimeException JavaDoc( "Compiler Error: trying to reassign container for " + name );
115         }
116         if( s == null )
117             throw new RuntimeException JavaDoc( "Compiler Error: enclosing symbol is null!");
118
119         enclosing_symbol = s;
120         value.setEnclosingSymbol( s );
121     }
122
123     public String JavaDoc printReadExpression( String JavaDoc streamname )
124     {
125         return value.printReadExpression( streamname );
126     }
127
128     public String JavaDoc printReadStatement( String JavaDoc var_name, String JavaDoc streamname )
129     {
130         return value.printReadStatement( var_name, streamname );
131     }
132
133     public String JavaDoc printWriteStatement( String JavaDoc var_name, String JavaDoc streamname )
134     {
135         return value.printWriteStatement( var_name, streamname );
136     }
137
138     /**
139      */

140
141     public void accept( IDLTreeVisitor visitor )
142     {
143         value.accept( visitor );
144     }
145
146
147 }
148
Popular Tags