KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > kawa > xml > UntypedAtomic


1 package gnu.kawa.xml;
2
3 /** A loosely typed string.
4  * Can be cast as needed to numbers and other types.
5  * Implements the {@code xs:untypedAtomic} type of XPath/XQuery, which use
6  * it to represent attribute and text values of unvalidated XML.
7  */

8
9 public class UntypedAtomic
10 {
11   String JavaDoc text;
12
13   public String JavaDoc toString ()
14   {
15     return text;
16   }
17
18   public UntypedAtomic (String JavaDoc text)
19   {
20     this.text = text;
21   }
22
23   public int hashCode ()
24   {
25     return text.hashCode();
26   }
27
28   public boolean equals (Object JavaDoc arg)
29   {
30     return arg instanceof UntypedAtomic
31       && text.equals(((UntypedAtomic) arg).text);
32   }
33 }
34
Popular Tags