1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package com.sun.org.apache.xerces.internal.util; 23 24 import com.sun.org.apache.xerces.internal.impl.XMLEntityDescription; 25 26 /** 27 * <p>This class is an implementation of the XMLEntityDescription 28 * interface which describes the properties of an entity.</p> 29 * 30 * @author Michael Glavassevich, IBM 31 * 32 */ 33 public class XMLEntityDescriptionImpl 34 extends XMLResourceIdentifierImpl 35 implements XMLEntityDescription { 36 37 // 38 // Constructors 39 // 40 41 /** Constructs an empty entity description. */ XMLEntityDescriptionImpl()42 public XMLEntityDescriptionImpl() {} // <init>() 43 44 /** 45 * Constructs an entity description. 46 * 47 * @param entityName The name of the entity. 48 * @param publicId The public identifier. 49 * @param literalSystemId The literal system identifier. 50 * @param baseSystemId The base system identifier. 51 * @param expandedSystemId The expanded system identifier. 52 */ XMLEntityDescriptionImpl(String entityName, String publicId, String literalSystemId, String baseSystemId, String expandedSystemId)53 public XMLEntityDescriptionImpl(String entityName, String publicId, String literalSystemId, 54 String baseSystemId, String expandedSystemId) { 55 setDescription(entityName, publicId, literalSystemId, baseSystemId, expandedSystemId); 56 } // <init>(String,String,String,String,String) 57 58 /** 59 * Constructs a resource identifier. 60 * 61 * @param entityName The name of the entity. 62 * @param publicId The public identifier. 63 * @param literalSystemId The literal system identifier. 64 * @param baseSystemId The base system identifier. 65 * @param expandedSystemId The expanded system identifier. 66 * @param namespace The namespace. 67 */ XMLEntityDescriptionImpl(String entityName, String publicId, String literalSystemId, String baseSystemId, String expandedSystemId, String namespace)68 public XMLEntityDescriptionImpl(String entityName, String publicId, String literalSystemId, 69 String baseSystemId, String expandedSystemId, String namespace) { 70 setDescription(entityName, publicId, literalSystemId, baseSystemId, expandedSystemId, namespace); 71 } // <init>(String,String,String,String,String,String) 72 73 // 74 // Data 75 // 76 77 /** The name of the entity. */ 78 protected String fEntityName; 79 80 // 81 // Public methods 82 // 83 84 /** 85 * Sets the name of the entity. 86 * 87 * @param name the name of the entity 88 */ setEntityName(String name)89 public void setEntityName(String name) { 90 fEntityName = name; 91 } // setEntityName(String) 92 93 /** 94 * Returns the name of the entity. 95 * 96 * @return the name of the entity 97 */ getEntityName()98 public String getEntityName() { 99 return fEntityName; 100 } // getEntityName():String 101 102 /** 103 * <p>Sets the values of this entity description.</p> 104 * 105 * @param entityName The name of the entity. 106 * @param publicId The public identifier. 107 * @param literalSystemId The literal system identifier. 108 * @param baseSystemId The base system identifier. 109 * @param expandedSystemId The expanded system identifier. 110 */ setDescription(String entityName, String publicId, String literalSystemId, String baseSystemId, String expandedSystemId)111 public void setDescription(String entityName, String publicId, String literalSystemId, 112 String baseSystemId, String expandedSystemId) { 113 setDescription(entityName, publicId, literalSystemId, baseSystemId, expandedSystemId, null); 114 } // setDescription(String,String,String,String,String) 115 116 /** 117 * <p>Sets the values of this entity description.</p> 118 * 119 * @param entityName The name of the entity. 120 * @param publicId The public identifier. 121 * @param literalSystemId The literal system identifier. 122 * @param baseSystemId The base system identifier. 123 * @param expandedSystemId The expanded system identifier. 124 * @param namespace The namespace. 125 */ setDescription(String entityName, String publicId, String literalSystemId, String baseSystemId, String expandedSystemId, String namespace)126 public void setDescription(String entityName, String publicId, String literalSystemId, 127 String baseSystemId, String expandedSystemId, String namespace) { 128 fEntityName = entityName; 129 setValues(publicId, literalSystemId, baseSystemId, expandedSystemId, namespace); 130 } // setDescription(String,String,String,String,String,String) 131 132 /** 133 * <p>Clears the values.</p> 134 */ clear()135 public void clear() { 136 super.clear(); 137 fEntityName = null; 138 } // clear() 139 140 // 141 // Object methods 142 // 143 144 /** Returns a hash code for this object. */ hashCode()145 public int hashCode() { 146 int code = super.hashCode(); 147 if (fEntityName != null) { 148 code += fEntityName.hashCode(); 149 } 150 return code; 151 } // hashCode():int 152 153 /** Returns a string representation of this object. */ toString()154 public String toString() { 155 StringBuffer str = new StringBuffer(); 156 if (fEntityName != null) { 157 str.append(fEntityName); 158 } 159 str.append(':'); 160 if (fPublicId != null) { 161 str.append(fPublicId); 162 } 163 str.append(':'); 164 if (fLiteralSystemId != null) { 165 str.append(fLiteralSystemId); 166 } 167 str.append(':'); 168 if (fBaseSystemId != null) { 169 str.append(fBaseSystemId); 170 } 171 str.append(':'); 172 if (fExpandedSystemId != null) { 173 str.append(fExpandedSystemId); 174 } 175 str.append(':'); 176 if (fNamespace != null) { 177 str.append(fNamespace); 178 } 179 return str.toString(); 180 } // toString():String 181 182 } // XMLEntityDescriptionImpl 183