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: * @(#)IDLID.java 1.20 07/05/05
035: */
036:
037: package com.sun.tools.corba.se.idl;
038:
039: // NOTES:
040:
041: public class IDLID extends RepositoryID {
042: public IDLID() {
043: _prefix = "";
044: _name = "";
045: _version = "1.0";
046: } // ctor
047:
048: public IDLID(String prefix, String name, String version) {
049: _prefix = prefix;
050: _name = name;
051: _version = version;
052: } // ctor
053:
054: public String ID() {
055: if (_prefix.equals(""))
056: return "IDL:" + _name + ':' + _version;
057: else
058: return "IDL:" + _prefix + '/' + _name + ':' + _version;
059: } // ID
060:
061: public String prefix() {
062: return _prefix;
063: } // prefix
064:
065: void prefix(String prefix) {
066: if (prefix == null)
067: _prefix = "";
068: else
069: _prefix = prefix;
070: } // prefix
071:
072: public String name() {
073: return _name;
074: } // name
075:
076: void name(String name) {
077: if (name == null)
078: _name = "";
079: else
080: _name = name;
081: } // name
082:
083: public String version() {
084: return _version;
085: } // version
086:
087: void version(String version) {
088: if (version == null)
089: _version = "";
090: else
091: _version = version;
092: } // version
093:
094: void appendToName(String name) {
095: if (name != null)
096: if (_name.equals(""))
097: _name = name;
098: else
099: _name = _name + '/' + name;
100: } // appendToName
101:
102: void replaceName(String name) {
103: if (name == null)
104: _name = "";
105: else {
106: int index = _name.lastIndexOf('/');
107: if (index < 0)
108: _name = name;
109: else
110: _name = _name.substring(0, index + 1) + name;
111: }
112: } // replaceName
113:
114: public Object clone() {
115: return new IDLID(_prefix, _name, _version);
116: } // clone
117:
118: private String _prefix;
119: private String _name;
120: private String _version;
121: } // class IDLID
|