1 16 17 package org.apache.xerces.util; 18 19 import org.apache.xerces.xni.XMLResourceIdentifier; 20 21 30 public class XMLResourceIdentifierImpl 31 implements XMLResourceIdentifier { 32 33 37 38 protected String fPublicId; 39 40 41 protected String fLiteralSystemId; 42 43 44 protected String fBaseSystemId; 45 46 47 protected String fExpandedSystemId; 48 49 50 protected String fNamespace; 51 52 56 57 public XMLResourceIdentifierImpl() {} 59 67 public XMLResourceIdentifierImpl(String publicId, 68 String literalSystemId, String baseSystemId, 69 String expandedSystemId) { 70 setValues(publicId, literalSystemId, baseSystemId, 71 expandedSystemId, null); 72 } 74 83 public XMLResourceIdentifierImpl(String publicId, String literalSystemId, 84 String baseSystemId, String expandedSystemId, 85 String namespace) { 86 setValues(publicId, literalSystemId, baseSystemId, 87 expandedSystemId, namespace); 88 } 90 94 95 public void setValues(String publicId, String literalSystemId, 96 String baseSystemId, String expandedSystemId) { 97 setValues(publicId, literalSystemId, baseSystemId, 98 expandedSystemId, null); 99 } 101 102 public void setValues(String publicId, String literalSystemId, 103 String baseSystemId, String expandedSystemId, 104 String namespace) { 105 fPublicId = publicId; 106 fLiteralSystemId = literalSystemId; 107 fBaseSystemId = baseSystemId; 108 fExpandedSystemId = expandedSystemId; 109 fNamespace = namespace; 110 } 112 113 public void clear() { 114 fPublicId = null; 115 fLiteralSystemId = null; 116 fBaseSystemId = null; 117 fExpandedSystemId = null; 118 fNamespace = null; 119 } 121 122 public void setPublicId(String publicId) { 123 fPublicId = publicId; 124 } 126 127 public void setLiteralSystemId(String literalSystemId) { 128 fLiteralSystemId = literalSystemId; 129 } 131 132 public void setBaseSystemId(String baseSystemId) { 133 fBaseSystemId = baseSystemId; 134 } 136 137 public void setExpandedSystemId(String expandedSystemId) { 138 fExpandedSystemId = expandedSystemId; 139 } 141 142 public void setNamespace(String namespace) { 143 fNamespace = namespace; 144 } 146 150 151 public String getPublicId() { 152 return fPublicId; 153 } 155 156 public String getLiteralSystemId() { 157 return fLiteralSystemId; 158 } 160 163 public String getBaseSystemId() { 164 return fBaseSystemId; 165 } 167 168 public String getExpandedSystemId() { 169 return fExpandedSystemId; 170 } 172 173 public String getNamespace() { 174 return fNamespace; 175 } 177 181 182 public int hashCode() { 183 int code = 0; 184 if (fPublicId != null) { 185 code += fPublicId.hashCode(); 186 } 187 if (fLiteralSystemId != null) { 188 code += fLiteralSystemId.hashCode(); 189 } 190 if (fBaseSystemId != null) { 191 code += fBaseSystemId.hashCode(); 192 } 193 if (fExpandedSystemId != null) { 194 code += fExpandedSystemId.hashCode(); 195 } 196 if (fNamespace != null) { 197 code += fNamespace.hashCode(); 198 } 199 return code; 200 } 202 203 public String toString() { 204 StringBuffer str = new StringBuffer (); 205 if (fPublicId != null) { 206 str.append(fPublicId); 207 } 208 str.append(':'); 209 if (fLiteralSystemId != null) { 210 str.append(fLiteralSystemId); 211 } 212 str.append(':'); 213 if (fBaseSystemId != null) { 214 str.append(fBaseSystemId); 215 } 216 str.append(':'); 217 if (fExpandedSystemId != null) { 218 str.append(fExpandedSystemId); 219 } 220 str.append(':'); 221 if (fNamespace != null) { 222 str.append(fNamespace); 223 } 224 return str.toString(); 225 } 227 } | Popular Tags |