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: * @(#)EnumEntry.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 enumerated types.
047: **/
048: public class EnumEntry extends SymtabEntry {
049: protected EnumEntry() {
050: super ();
051: } // ctor
052:
053: protected EnumEntry(EnumEntry that) {
054: super (that);
055: _elements = (Vector) that._elements.clone();
056: } // ctor
057:
058: protected EnumEntry(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 EnumEntry(this );
069: } // clone
070:
071: /** Invoke the enumerator 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: enumGen.generate(symbolTable, this , stream);
079: } // generate
080:
081: /** Access the enumerator generator.
082: @returns an object which implements the EnumGen interface.
083: @see EnumGen */
084: public Generator generator() {
085: return enumGen;
086: } // generator
087:
088: /** Add an element to the list of elements. */
089: public void addElement(String element) {
090: _elements.addElement(element);
091: } // addElement
092:
093: /** Each element of the vector is a String. */
094: public Vector elements() {
095: return _elements;
096: } // elements
097:
098: static EnumGen enumGen;
099: private Vector _elements = new Vector();
100: } // class EnumEntry
|