KickJava   Java API By Example, From Geeks To Geeks.

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


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: Definition.java,v 1.15 2004/05/06 12:39:58 nicolas Exp $
26  */

27
28 import java.io.PrintWriter JavaDoc;
29
30
31 public class Definition
32     extends IdlSymbol
33 {
34     private Declaration declaration;
35
36     public Definition( int num )
37     {
38         super( num );
39         pack_name = "";
40     }
41
42     public Definition (Declaration d)
43     {
44         super (new_num());
45         pack_name = "";
46         this.declaration = d;
47     }
48
49     public void setPackage( String JavaDoc s )
50     {
51         s = parser.pack_replace( s );
52         super.setPackage( s );
53         declaration.setPackage( s );
54     }
55
56     public void setEnclosingSymbol( IdlSymbol s )
57     {
58         if( enclosing_symbol != null && enclosing_symbol != s )
59         {
60             logger.error("was " + enclosing_symbol.getClass().getName() + " now: " + s.getClass().getName() );
61             throw new RuntimeException JavaDoc( "Compiler Error: trying to reassign container for " + name );
62         }
63         enclosing_symbol = s;
64         declaration.setEnclosingSymbol( s );
65     }
66
67     public Declaration get_declaration()
68     {
69         return declaration;
70     }
71
72     public void set_declaration( Declaration d )
73     {
74         declaration = d;
75     }
76
77     public void set_included( boolean i )
78     {
79         included = i;
80         declaration.set_included( i );
81     }
82
83     public void print( PrintWriter JavaDoc ps )
84     {
85         declaration.print( ps );
86     }
87
88     public void parse()
89     {
90         declaration.parse();
91     }
92
93     /**
94      */

95
96     public void accept( IDLTreeVisitor visitor )
97     {
98         visitor.visitDefinition( this );
99     }
100
101
102 }
103
Popular Tags