01: /*
02: * JacORB - a free Java ORB
03: *
04: * Copyright (C) 1997-2004 Gerald Brose.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Library General Public
08: * License as published by the Free Software Foundation; either
09: * 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;
29:
30: public class Definition extends IdlSymbol {
31: private Declaration declaration;
32:
33: public Definition(int num) {
34: super (num);
35: pack_name = "";
36: }
37:
38: public Definition(Declaration d) {
39: super (new_num());
40: pack_name = "";
41: this .declaration = d;
42: }
43:
44: public void setPackage(String s) {
45: s = parser.pack_replace(s);
46: super .setPackage(s);
47: declaration.setPackage(s);
48: }
49:
50: public void setEnclosingSymbol(IdlSymbol s) {
51: if (enclosing_symbol != null && enclosing_symbol != s) {
52: logger.error("was " + enclosing_symbol.getClass().getName()
53: + " now: " + s.getClass().getName());
54: throw new RuntimeException(
55: "Compiler Error: trying to reassign container for "
56: + name);
57: }
58: enclosing_symbol = s;
59: declaration.setEnclosingSymbol(s);
60: }
61:
62: public Declaration get_declaration() {
63: return declaration;
64: }
65:
66: public void set_declaration(Declaration d) {
67: declaration = d;
68: }
69:
70: public void set_included(boolean i) {
71: included = i;
72: declaration.set_included(i);
73: }
74:
75: public void print(PrintWriter ps) {
76: declaration.print(ps);
77: }
78:
79: public void parse() {
80: declaration.parse();
81: }
82:
83: /**
84: */
85:
86: public void accept(IDLTreeVisitor visitor) {
87: visitor.visitDefinition(this);
88: }
89:
90: }
|