KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > util > XMLEntityDescriptionImpl


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16  
17 package org.apache.xerces.util;
18
19 import org.apache.xerces.impl.XMLEntityDescription;
20
21 /**
22  * <p>This class is an implementation of the XMLEntityDescription
23  * interface which describes the properties of an entity.</p>
24  *
25  * @author Michael Glavassevich, IBM
26  *
27  * @version $Id: XMLEntityDescriptionImpl.java,v 1.1 2004/03/16 22:03:22 mrglavas Exp $
28  */

29 public class XMLEntityDescriptionImpl
30     extends XMLResourceIdentifierImpl
31     implements XMLEntityDescription {
32         
33     //
34
// Constructors
35
//
36

37     /** Constructs an empty entity description. */
38     public XMLEntityDescriptionImpl() {} // <init>()
39

40     /**
41      * Constructs an entity description.
42      *
43      * @param entityName The name of the entity.
44      * @param publicId The public identifier.
45      * @param literalSystemId The literal system identifier.
46      * @param baseSystemId The base system identifier.
47      * @param expandedSystemId The expanded system identifier.
48      */

49     public XMLEntityDescriptionImpl(String JavaDoc entityName, String JavaDoc publicId, String JavaDoc literalSystemId,
50                                     String JavaDoc baseSystemId, String JavaDoc expandedSystemId) {
51         setDescription(entityName, publicId, literalSystemId, baseSystemId, expandedSystemId);
52     } // <init>(String,String,String,String,String)
53

54     /**
55      * Constructs a resource identifier.
56      *
57      * @param entityName The name of the entity.
58      * @param publicId The public identifier.
59      * @param literalSystemId The literal system identifier.
60      * @param baseSystemId The base system identifier.
61      * @param expandedSystemId The expanded system identifier.
62      * @param namespace The namespace.
63      */

64     public XMLEntityDescriptionImpl(String JavaDoc entityName, String JavaDoc publicId, String JavaDoc literalSystemId,
65                                     String JavaDoc baseSystemId, String JavaDoc expandedSystemId, String JavaDoc namespace) {
66         setDescription(entityName, publicId, literalSystemId, baseSystemId, expandedSystemId, namespace);
67     } // <init>(String,String,String,String,String,String)
68

69     //
70
// Data
71
//
72

73     /** The name of the entity. */
74     protected String JavaDoc fEntityName;
75
76     //
77
// Public methods
78
//
79

80     /**
81      * Sets the name of the entity.
82      *
83      * @param name the name of the entity
84      */

85     public void setEntityName(String JavaDoc name) {
86         fEntityName = name;
87     } // setEntityName(String)
88

89     /**
90      * Returns the name of the entity.
91      *
92      * @return the name of the entity
93      */

94     public String JavaDoc getEntityName() {
95         return fEntityName;
96     } // getEntityName():String
97

98     /**
99      * <p>Sets the values of this entity description.</p>
100      *
101      * @param entityName The name of the entity.
102      * @param publicId The public identifier.
103      * @param literalSystemId The literal system identifier.
104      * @param baseSystemId The base system identifier.
105      * @param expandedSystemId The expanded system identifier.
106      */

107     public void setDescription(String JavaDoc entityName, String JavaDoc publicId, String JavaDoc literalSystemId,
108                                String JavaDoc baseSystemId, String JavaDoc expandedSystemId) {
109         setDescription(entityName, publicId, literalSystemId, baseSystemId, expandedSystemId, null);
110     } // setDescription(String,String,String,String,String)
111

112     /**
113      * <p>Sets the values of this entity description.</p>
114      *
115      * @param entityName The name of the entity.
116      * @param publicId The public identifier.
117      * @param literalSystemId The literal system identifier.
118      * @param baseSystemId The base system identifier.
119      * @param expandedSystemId The expanded system identifier.
120      * @param namespace The namespace.
121      */

122     public void setDescription(String JavaDoc entityName, String JavaDoc publicId, String JavaDoc literalSystemId,
123                                String JavaDoc baseSystemId, String JavaDoc expandedSystemId, String JavaDoc namespace) {
124         fEntityName = entityName;
125         setValues(publicId, literalSystemId, baseSystemId, expandedSystemId, namespace);
126     } // setDescription(String,String,String,String,String,String)
127

128     /**
129      * <p>Clears the values.</p>
130      */

131     public void clear() {
132         super.clear();
133         fEntityName = null;
134     } // clear()
135

136     //
137
// Object methods
138
//
139

140     /** Returns a hash code for this object. */
141     public int hashCode() {
142         int code = super.hashCode();
143         if (fEntityName != null) {
144             code += fEntityName.hashCode();
145         }
146         return code;
147     } // hashCode():int
148

149     /** Returns a string representation of this object. */
150     public String JavaDoc toString() {
151         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
152         if (fEntityName != null) {
153             str.append(fEntityName);
154         }
155         str.append(':');
156         if (fPublicId != null) {
157             str.append(fPublicId);
158         }
159         str.append(':');
160         if (fLiteralSystemId != null) {
161             str.append(fLiteralSystemId);
162         }
163         str.append(':');
164         if (fBaseSystemId != null) {
165             str.append(fBaseSystemId);
166         }
167         str.append(':');
168         if (fExpandedSystemId != null) {
169             str.append(fExpandedSystemId);
170         }
171         str.append(':');
172         if (fNamespace != null) {
173             str.append(fNamespace);
174         }
175         return str.toString();
176     } // toString():String
177

178 } // XMLEntityDescriptionImpl
179
Popular Tags