001: /*
002: * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: /*
026: * COMPONENT_NAME: idl.parser
027: *
028: * ORIGINS: 27
029: *
030: * Licensed Materials - Property of IBM
031: * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
032: * RMI-IIOP v1.0
033: *
034: * @(#)ModuleEntry.java 1.20 07/05/05
035: */
036:
037: package com.sun.tools.corba.se.idl;
038:
039: // NOTES:
040:
041: import java.io.PrintWriter;
042: import java.util.Hashtable;
043: import java.util.Vector;
044:
045: /**
046: * This is the symbol table entry for modules.
047: **/
048: public class ModuleEntry extends SymtabEntry {
049: protected ModuleEntry() {
050: super ();
051: } // ctor
052:
053: protected ModuleEntry(ModuleEntry that) {
054: super (that);
055: _contained = (Vector) that._contained.clone();
056: } // ctor
057:
058: protected ModuleEntry(SymtabEntry that, IDLID clone) {
059: super (that, clone);
060:
061: if (module().equals(""))
062: module(name());
063: else if (!name().equals(""))
064: module(module() + "/" + name());
065: } // ctor
066:
067: public Object clone() {
068: return new ModuleEntry(this );
069: } // clone
070:
071: /** Invoke the module generator.
072: @param symbolTable the symbol table is a hash table whose key is
073: a fully qualified type name and whose value is a SymtabEntry or
074: a subclass of SymtabEntry.
075: @param stream the stream to which the generator should sent its output.
076: @see SymtabEntry */
077: public void generate(Hashtable symbolTable, PrintWriter stream) {
078: moduleGen.generate(symbolTable, this , stream);
079: } // generate
080:
081: /** Access the module generator.
082: @returns an object which implements the ModuleGen interface.
083: @see ModuleGen */
084: public Generator generator() {
085: return moduleGen;
086: } // generator
087:
088: /** alid entries in this vector are: TypedefEntry, ExceptionEntry,
089: StructEntry, UnionEntry, EnumEntry, ConstEntry, InterfaceEntry,
090: ModuleEntry. */
091: public void addContained(SymtabEntry entry) {
092: _contained.addElement(entry);
093: } // addContained
094:
095: /** This is a vector of SymtabEntry's. Valid entries in this vector are:
096: TypedefEntry, ExceptionEntry, StructEntry, UnionEntry, EnumEntry,
097: ConstEntry, InterfaceEntry, ModuleEntry. */
098: public Vector contained() {
099: return _contained;
100: } // contained
101:
102: private Vector _contained = new Vector();
103:
104: static ModuleGen moduleGen;
105: } // class ModuleEntry
|