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: import java.io.PrintWriter;
24: import java.util.*;
25:
26: /**
27: * @author Gerald Brose
28: * @version $Id: Definitions.java,v 1.14 2004/05/06 12:39:58 nicolas Exp $
29: */
30:
31: public class Definitions extends SymbolList {
32:
33: public Definitions(int num) {
34: super (num);
35: v = new Vector();
36: }
37:
38: public void setPackage(String s) {
39: s = parser.pack_replace(s);
40: Enumeration e = getElements();
41: for (; e.hasMoreElements();) {
42: IdlSymbol i = (IdlSymbol) e.nextElement();
43: i.setPackage(s);
44: }
45: }
46:
47: public void setEnclosingSymbol(IdlSymbol s) {
48: if (enclosing_symbol != null && enclosing_symbol != s) {
49: logger.error("was " + enclosing_symbol.getClass().getName()
50: + " now: " + s.getClass().getName());
51: throw new RuntimeException(
52: "Compiler Error: trying to reassign container for "
53: + name);
54: }
55: enclosing_symbol = s;
56: for (Enumeration e = getElements(); e.hasMoreElements();)
57: ((IdlSymbol) e.nextElement()).setEnclosingSymbol(s);
58: }
59:
60: public void set_included(boolean i) {
61: included = i;
62: Enumeration e = getElements();
63: for (; e.hasMoreElements();)
64: ((IdlSymbol) e.nextElement()).set_included(i);
65: }
66:
67: public Enumeration getElements() {
68: return v.elements();
69: }
70:
71: public void print(PrintWriter ps) {
72: Enumeration e = getElements();
73: for (; e.hasMoreElements();)
74: ((IdlSymbol) e.nextElement()).print(ps);
75: }
76:
77: /**
78: */
79:
80: public void accept(IDLTreeVisitor visitor) {
81: visitor.visitDefinitions(this);
82: }
83: }
|