001: /*
002: * Copyright 1999-2004 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: * @(#)TypedefEntry.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: import com.sun.tools.corba.se.idl.constExpr.Expression;
046:
047: /**
048: * This is the symbol table entry for typedefs.
049: **/
050: public class TypedefEntry extends SymtabEntry {
051: protected TypedefEntry() {
052: super ();
053: } // ctor
054:
055: protected TypedefEntry(TypedefEntry that) {
056: super (that);
057: _arrayInfo = (Vector) that._arrayInfo.clone();
058: } // ctor
059:
060: protected TypedefEntry(SymtabEntry that, IDLID clone) {
061: super (that, clone);
062: if (module().equals(""))
063: module(name());
064: else if (!name().equals(""))
065: module(module() + "/" + name());
066: } // ctor
067:
068: /** This method returns a vector of Expressions, each expression
069: represents a dimension in an array. A zero-length vector indicates
070: no array information.*/
071: public Vector arrayInfo() {
072: return _arrayInfo;
073: } // arrayInfo
074:
075: public void addArrayInfo(Expression e) {
076: _arrayInfo.addElement(e);
077: } // addArrayInfo
078:
079: public Object clone() {
080: return new TypedefEntry(this );
081: } // clone
082:
083: /** Invoke the typedef generator.
084: @param symbolTable the symbol table is a hash table whose key is
085: a fully qualified type name and whose value is a SymtabEntry or
086: a subclass of SymtabEntry.
087: @param stream the stream to which the generator should sent its output.
088: @see SymtabEntry */
089: public void generate(Hashtable symbolTable, PrintWriter stream) {
090: typedefGen.generate(symbolTable, this , stream);
091: } // generate
092:
093: public boolean isReferencable() {
094: // A typedef is referencable if its component
095: // type is.
096: return type().isReferencable();
097: }
098:
099: public void isReferencable(boolean value) {
100: // NO-OP: this cannot be set for a typedef.
101: }
102:
103: /** Access the typedef generator.
104: @returns an object which implements the TypedefGen interface.
105: @see TypedefGen */
106: public Generator generator() {
107: return typedefGen;
108: } // generator
109:
110: private Vector _arrayInfo = new Vector();
111:
112: static TypedefGen typedefGen;
113: } // class TypedefEntry
|