1 /* 2 * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 /* 26 * COMPONENT_NAME: idl.parser 27 * 28 * ORIGINS: 27 29 * 30 * Licensed Materials - Property of IBM 31 * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 32 * RMI-IIOP v1.0 33 * 34 */ 35 36 package com.sun.tools.corba.se.idl; 37 38 // NOTES: 39 40 public class IDLID extends RepositoryID 41 { 42 public IDLID () 43 { 44 _prefix = ""; 45 _name = ""; 46 _version = "1.0"; 47 } // ctor 48 49 public IDLID (String prefix, String name, String version) 50 { 51 _prefix = prefix; 52 _name = name; 53 _version = version; 54 } // ctor 55 56 public String ID () 57 { 58 if (_prefix.equals ("")) 59 return "IDL:" + _name + ':' + _version; 60 else 61 return "IDL:" + _prefix + '/' + _name + ':' + _version; 62 } // ID 63 64 public String prefix () 65 { 66 return _prefix; 67 } // prefix 68 69 void prefix (String prefix) 70 { 71 if (prefix == null) 72 _prefix = ""; 73 else 74 _prefix = prefix; 75 } // prefix 76 77 public String name () 78 { 79 return _name; 80 } // name 81 82 void name (String name) 83 { 84 if (name == null) 85 _name = ""; 86 else 87 _name = name; 88 } // name 89 90 public String version () 91 { 92 return _version; 93 } // version 94 95 void version (String version) 96 { 97 if (version == null) 98 _version = ""; 99 else 100 _version = version; 101 } // version 102 103 void appendToName (String name) 104 { 105 if (name != null) 106 if (_name.equals ("")) 107 _name = name; 108 else 109 _name = _name + '/' + name; 110 } // appendToName 111 112 void replaceName (String name) 113 { 114 if (name == null) 115 _name = ""; 116 else 117 { 118 int index = _name.lastIndexOf ('/'); 119 if (index < 0) 120 _name = name; 121 else 122 _name = _name.substring (0, index + 1) + name; 123 } 124 } // replaceName 125 126 public Object clone () 127 { 128 return new IDLID (_prefix, _name, _version); 129 } // clone 130 131 private String _prefix; 132 private String _name; 133 private String _version; 134 } // class IDLID