ModuleEntry.java revision 608:7e06bf1dcb09
1139790Simp/*
24Srgrimes * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
34Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44Srgrimes *
54Srgrimes * This code is free software; you can redistribute it and/or modify it
64Srgrimes * under the terms of the GNU General Public License version 2 only, as
74Srgrimes * published by the Free Software Foundation.  Oracle designates this
84Srgrimes * particular file as subject to the "Classpath" exception as provided
94Srgrimes * by Oracle in the LICENSE file that accompanied this code.
104Srgrimes *
114Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
124Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
134Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
144Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
154Srgrimes * accompanied this code).
164Srgrimes *
174Srgrimes * You should have received a copy of the GNU General Public License version
184Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
194Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
204Srgrimes *
214Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
224Srgrimes * or visit www.oracle.com if you need additional information or have any
234Srgrimes * questions.
244Srgrimes */
254Srgrimes/*
264Srgrimes * COMPONENT_NAME: idl.parser
274Srgrimes *
284Srgrimes * ORIGINS: 27
29621Srgrimes *
3050477Speter * Licensed Materials - Property of IBM
314Srgrimes * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
324Srgrimes * RMI-IIOP v1.0
33719Swollman *
3425549Speter */
35719Swollman
3685449Sjhbpackage com.sun.tools.corba.se.idl;
3746129Sluoqi
3885449Sjhb// NOTES:
3985449Sjhb
4085449Sjhbimport java.io.PrintWriter;
4185449Sjhbimport java.util.Hashtable;
4285449Sjhbimport java.util.Vector;
4385449Sjhb
4485449Sjhb/**
4585449Sjhb * This is the symbol table entry for modules.
464Srgrimes **/
4715174Snatepublic class ModuleEntry extends SymtabEntry
48169802Sjeff{
49169802Sjeff  protected ModuleEntry ()
504Srgrimes  {
5183366Sjulian    super ();
52144637Sjhb  }  // ctor
53144637Sjhb
54233647Salc  protected ModuleEntry (ModuleEntry that)
5583366Sjulian  {
5683366Sjulian    super (that);
574Srgrimes    _contained = (Vector)that._contained.clone ();
58169802Sjeff  } // ctor
594Srgrimes
604Srgrimes  protected ModuleEntry (SymtabEntry that, IDLID clone)
61207269Skib  {
62207152Skib    super (that, clone);
6385449Sjhb
6485449Sjhb    if (module ().equals (""))
65175846Smav      module (name ());
66175846Smav    else if (!name ().equals (""))
67175846Smav      module (module () + "/" + name ());
68175846Smav  } // ctor
69175846Smav
70175846Smav  public Object clone ()
71175846Smav  {
72175846Smav    return new ModuleEntry (this);
73175846Smav  } // clone
7492761Salfred
7592761Salfred  /** Invoke the module generator.
7692761Salfred      @param symbolTable the symbol table is a hash table whose key is
77182961Skib       a fully qualified type name and whose value is a SymtabEntry or
7885449Sjhb       a subclass of SymtabEntry.
79169802Sjeff      @param stream the stream to which the generator should sent its output.
80169802Sjeff      @see SymtabEntry */
81208453Skib  public void generate (Hashtable symbolTable, PrintWriter stream)
82208453Skib  {
83208453Skib    moduleGen.generate (symbolTable, this, stream);
84208453Skib  } // generate
85208453Skib
86208453Skib  /** Access the module generator.
8785449Sjhb      @returns an object which implements the ModuleGen interface.
8885449Sjhb      @see ModuleGen */
8925549Speter  public Generator generator ()
90  {
91    return moduleGen;
92  } // generator
93
94  /** alid entries in this vector are:  TypedefEntry, ExceptionEntry,
95      StructEntry, UnionEntry, EnumEntry, ConstEntry, InterfaceEntry,
96      ModuleEntry. */
97  public void addContained (SymtabEntry entry)
98  {
99    _contained.addElement (entry);
100  } // addContained
101
102  /** This is a vector of SymtabEntry's.  Valid entries in this vector are:
103      TypedefEntry, ExceptionEntry, StructEntry, UnionEntry, EnumEntry,
104      ConstEntry, InterfaceEntry, ModuleEntry. */
105  public Vector contained ()
106  {
107    return _contained;
108  } // contained
109
110  private Vector _contained = new Vector ();
111
112  static ModuleGen moduleGen;
113} // class ModuleEntry
114