Source Code Cross Referenced for QualifiedName.java in  » 6.0-JDK-Modules-com.sun » fastinfoset » com » sun » xml » fastinfoset » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » fastinfoset » com.sun.xml.fastinfoset 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Fast Infoset ver. 0.1 software ("Software")
003:         * 
004:         * Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved. 
005:         * 
006:         * Software is licensed under the Apache License, Version 2.0 (the "License");
007:         * you may not use this file except in compliance with the License. You may
008:         * obtain a copy of the License at:
009:         * 
010:         *        http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         *    Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015:         * License for the specific language governing permissions and limitations.
016:         * 
017:         *    Sun supports and benefits from the global community of open source
018:         * developers, and thanks the community for its important contributions and
019:         * open standards-based technology, which Sun has adopted into many of its
020:         * products.
021:         * 
022:         *    Please note that portions of Software may be provided with notices and
023:         * open source licenses from such communities and third parties that govern the
024:         * use of those portions, and any licenses granted hereunder do not alter any
025:         * rights and obligations you may have under such open source licenses,
026:         * however, the disclaimer of warranty and limitation of liability provisions
027:         * in this License will apply to all Software in this distribution.
028:         * 
029:         *    You acknowledge that the Software is not designed, licensed or intended
030:         * for use in the design, construction, operation or maintenance of any nuclear
031:         * facility.
032:         *
033:         * Apache License
034:         * Version 2.0, January 2004
035:         * http://www.apache.org/licenses/
036:         *
037:         */
038:
039:        package com.sun.xml.fastinfoset;
040:
041:        import javax.xml.namespace.QName;
042:
043:        public class QualifiedName {
044:            public String prefix;
045:            public String namespaceName;
046:            public String localName;
047:            public String qName;
048:            public int index;
049:            public int prefixIndex;
050:            public int namespaceNameIndex;
051:            public int localNameIndex;
052:            public int attributeId;
053:            public int attributeHash;
054:            private QName qNameObject;
055:
056:            public QualifiedName() {
057:            }
058:
059:            public QualifiedName(String prefix, String namespaceName,
060:                    String localName, String qName) {
061:                this .prefix = prefix;
062:                this .namespaceName = namespaceName;
063:                this .localName = localName;
064:                this .qName = qName;
065:                this .index = -1;
066:                this .prefixIndex = 0;
067:                this .namespaceNameIndex = 0;
068:                this .localNameIndex = -1;
069:            }
070:
071:            public void set(String prefix, String namespaceName,
072:                    String localName, String qName) {
073:                this .prefix = prefix;
074:                this .namespaceName = namespaceName;
075:                this .localName = localName;
076:                this .qName = qName;
077:                this .index = -1;
078:                this .prefixIndex = 0;
079:                this .namespaceNameIndex = 0;
080:                this .localNameIndex = -1;
081:                this .qNameObject = null;
082:            }
083:
084:            public QualifiedName(String prefix, String namespaceName,
085:                    String localName, String qName, int index) {
086:                this .prefix = prefix;
087:                this .namespaceName = namespaceName;
088:                this .localName = localName;
089:                this .qName = qName;
090:                this .index = index;
091:                this .prefixIndex = 0;
092:                this .namespaceNameIndex = 0;
093:                this .localNameIndex = -1;
094:            }
095:
096:            public final QualifiedName set(String prefix, String namespaceName,
097:                    String localName, String qName, int index) {
098:                this .prefix = prefix;
099:                this .namespaceName = namespaceName;
100:                this .localName = localName;
101:                this .qName = qName;
102:                this .index = index;
103:                this .prefixIndex = 0;
104:                this .namespaceNameIndex = 0;
105:                this .localNameIndex = -1;
106:                this .qNameObject = null;
107:                return this ;
108:            }
109:
110:            public QualifiedName(String prefix, String namespaceName,
111:                    String localName, String qName, int index, int prefixIndex,
112:                    int namespaceNameIndex, int localNameIndex) {
113:                this .prefix = prefix;
114:                this .namespaceName = namespaceName;
115:                this .localName = localName;
116:                this .qName = qName;
117:                this .index = index;
118:                this .prefixIndex = prefixIndex + 1;
119:                this .namespaceNameIndex = namespaceNameIndex + 1;
120:                this .localNameIndex = localNameIndex;
121:            }
122:
123:            public final QualifiedName set(String prefix, String namespaceName,
124:                    String localName, String qName, int index, int prefixIndex,
125:                    int namespaceNameIndex, int localNameIndex) {
126:                this .prefix = prefix;
127:                this .namespaceName = namespaceName;
128:                this .localName = localName;
129:                this .qName = qName;
130:                this .index = index;
131:                this .prefixIndex = prefixIndex + 1;
132:                this .namespaceNameIndex = namespaceNameIndex + 1;
133:                this .localNameIndex = localNameIndex;
134:                this .qNameObject = null;
135:                return this ;
136:            }
137:
138:            public QualifiedName(String prefix, String namespaceName,
139:                    String localName) {
140:                this .prefix = prefix;
141:                this .namespaceName = namespaceName;
142:                this .localName = localName;
143:                this .qName = createQNameString(prefix, localName);
144:                this .index = -1;
145:                this .prefixIndex = 0;
146:                this .namespaceNameIndex = 0;
147:                this .localNameIndex = -1;
148:            }
149:
150:            public final QualifiedName set(String prefix, String namespaceName,
151:                    String localName) {
152:                this .prefix = prefix;
153:                this .namespaceName = namespaceName;
154:                this .localName = localName;
155:                this .qName = createQNameString(prefix, localName);
156:                this .index = -1;
157:                this .prefixIndex = 0;
158:                this .namespaceNameIndex = 0;
159:                this .localNameIndex = -1;
160:                this .qNameObject = null;
161:                return this ;
162:            }
163:
164:            public QualifiedName(String prefix, String namespaceName,
165:                    String localName, int prefixIndex, int namespaceNameIndex,
166:                    int localNameIndex, char[] charBuffer) {
167:                this .prefix = prefix;
168:                this .namespaceName = namespaceName;
169:                this .localName = localName;
170:
171:                if (charBuffer != null) {
172:                    final int l1 = prefix.length();
173:                    final int l2 = localName.length();
174:                    final int total = l1 + l2 + 1;
175:                    if (total < charBuffer.length) {
176:                        prefix.getChars(0, l1, charBuffer, 0);
177:                        charBuffer[l1] = ':';
178:                        localName.getChars(0, l2, charBuffer, l1 + 1);
179:                        this .qName = new String(charBuffer, 0, total);
180:                    } else {
181:                        this .qName = createQNameString(prefix, localName);
182:                    }
183:                } else {
184:                    this .qName = this .localName;
185:                }
186:
187:                this .prefixIndex = prefixIndex + 1;
188:                this .namespaceNameIndex = namespaceNameIndex + 1;
189:                this .localNameIndex = localNameIndex;
190:                this .index = -1;
191:            }
192:
193:            public final QualifiedName set(String prefix, String namespaceName,
194:                    String localName, int prefixIndex, int namespaceNameIndex,
195:                    int localNameIndex, char[] charBuffer) {
196:                this .prefix = prefix;
197:                this .namespaceName = namespaceName;
198:                this .localName = localName;
199:
200:                if (charBuffer != null) {
201:                    final int l1 = prefix.length();
202:                    final int l2 = localName.length();
203:                    final int total = l1 + l2 + 1;
204:                    if (total < charBuffer.length) {
205:                        prefix.getChars(0, l1, charBuffer, 0);
206:                        charBuffer[l1] = ':';
207:                        localName.getChars(0, l2, charBuffer, l1 + 1);
208:                        this .qName = new String(charBuffer, 0, total);
209:                    } else {
210:                        this .qName = createQNameString(prefix, localName);
211:                    }
212:                } else {
213:                    this .qName = this .localName;
214:                }
215:
216:                this .prefixIndex = prefixIndex + 1;
217:                this .namespaceNameIndex = namespaceNameIndex + 1;
218:                this .localNameIndex = localNameIndex;
219:                this .index = -1;
220:                this .qNameObject = null;
221:                return this ;
222:            }
223:
224:            public QualifiedName(String prefix, String namespaceName,
225:                    String localName, int index) {
226:                this .prefix = prefix;
227:                this .namespaceName = namespaceName;
228:                this .localName = localName;
229:                this .qName = createQNameString(prefix, localName);
230:                this .index = index;
231:                this .prefixIndex = 0;
232:                this .namespaceNameIndex = 0;
233:                this .localNameIndex = -1;
234:            }
235:
236:            public final QualifiedName set(String prefix, String namespaceName,
237:                    String localName, int index) {
238:                this .prefix = prefix;
239:                this .namespaceName = namespaceName;
240:                this .localName = localName;
241:                this .qName = createQNameString(prefix, localName);
242:                this .index = index;
243:                this .prefixIndex = 0;
244:                this .namespaceNameIndex = 0;
245:                this .localNameIndex = -1;
246:                this .qNameObject = null;
247:                return this ;
248:            }
249:
250:            public QualifiedName(String prefix, String namespaceName,
251:                    String localName, int index, int prefixIndex,
252:                    int namespaceNameIndex, int localNameIndex) {
253:                this .prefix = prefix;
254:                this .namespaceName = namespaceName;
255:                this .localName = localName;
256:                this .qName = createQNameString(prefix, localName);
257:                this .index = index;
258:                this .prefixIndex = prefixIndex + 1;
259:                this .namespaceNameIndex = namespaceNameIndex + 1;
260:                this .localNameIndex = localNameIndex;
261:            }
262:
263:            public final QualifiedName set(String prefix, String namespaceName,
264:                    String localName, int index, int prefixIndex,
265:                    int namespaceNameIndex, int localNameIndex) {
266:                this .prefix = prefix;
267:                this .namespaceName = namespaceName;
268:                this .localName = localName;
269:                this .qName = createQNameString(prefix, localName);
270:                this .index = index;
271:                this .prefixIndex = prefixIndex + 1;
272:                this .namespaceNameIndex = namespaceNameIndex + 1;
273:                this .localNameIndex = localNameIndex;
274:                this .qNameObject = null;
275:                return this ;
276:            }
277:
278:            // Qualified Name as a Namespace Name
279:            public QualifiedName(String prefix, String namespaceName) {
280:                this .prefix = prefix;
281:                this .namespaceName = namespaceName;
282:                this .localName = "";
283:                this .qName = "";
284:                this .index = -1;
285:                this .prefixIndex = 0;
286:                this .namespaceNameIndex = 0;
287:                this .localNameIndex = -1;
288:            }
289:
290:            public final QualifiedName set(String prefix, String namespaceName) {
291:                this .prefix = prefix;
292:                this .namespaceName = namespaceName;
293:                this .localName = "";
294:                this .qName = "";
295:                this .index = -1;
296:                this .prefixIndex = 0;
297:                this .namespaceNameIndex = 0;
298:                this .localNameIndex = -1;
299:                this .qNameObject = null;
300:                return this ;
301:            }
302:
303:            public final QName getQName() {
304:                if (qNameObject == null) {
305:                    qNameObject = new QName(namespaceName, localName, prefix);
306:                }
307:
308:                return qNameObject;
309:            }
310:
311:            public final String getQNameString() {
312:                if (this .qName != "") {
313:                    return this .qName;
314:                }
315:
316:                return this .qName = createQNameString(prefix, localName);
317:            }
318:
319:            public final void createAttributeValues(int size) {
320:                attributeId = localNameIndex | (namespaceNameIndex << 20);
321:                attributeHash = localNameIndex % size;
322:            }
323:
324:            private final String createQNameString(String p, String l) {
325:                if (p != null && p.length() > 0) {
326:                    final StringBuffer b = new StringBuffer(p);
327:                    b.append(':');
328:                    b.append(l);
329:                    return b.toString();
330:                } else {
331:                    return l;
332:                }
333:            }
334:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.