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: * @(#)ConstEntry.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:
044: import com.sun.tools.corba.se.idl.constExpr.Expression;
045:
046: /**
047: * This is the symbol table entry for constants.
048: **/
049: public class ConstEntry extends SymtabEntry {
050: protected ConstEntry() {
051: super ();
052: } // ctor
053:
054: protected ConstEntry(ConstEntry that) {
055: super (that);
056: if (module().equals(""))
057: module(name());
058: else if (!name().equals(""))
059: module(module() + "/" + name());
060: _value = that._value;
061: } // ctor
062:
063: /** This is a shallow copy constructor. */
064: protected ConstEntry(SymtabEntry that, IDLID clone) {
065: super (that, clone);
066: if (module().equals(""))
067: module(name());
068: else if (!name().equals(""))
069: module(module() + "/" + name());
070: } // ctor
071:
072: /** This is a shallow copy clone. */
073: public Object clone() {
074: return new ConstEntry(this );
075: } // clone
076:
077: /** Invoke the constant generator.
078: @param symbolTable the symbol table is a hash table whose key is
079: a fully qualified type name and whose value is a SymtabEntry or
080: a subclass of SymtabEntry.
081: @param stream the stream to which the generator should sent its output.
082: @see SymtabEntry */
083: public void generate(Hashtable symbolTable, PrintWriter stream) {
084: constGen.generate(symbolTable, this , stream);
085: } // generate
086:
087: /** Access the constant generator.
088: @returns an object which implements the ConstGen interface.
089: @see ConstGen */
090: public Generator generator() {
091: return constGen;
092: } // generator
093:
094: public Expression value() {
095: return _value;
096: } // value
097:
098: public void value(Expression newValue) {
099: _value = newValue;
100: } // value
101:
102: static ConstGen constGen;
103: private Expression _value = null;
104: } // class ConstEntry
|