01: // Copyright (c) 2007 Per M.A. Bothner.
02: // This is free software; for specifics see ../../../COPYING.
03:
04: package gnu.kawa.xml;
05:
06: public class XString
07: /* #ifdef use:java.lang.CharSequence */
08: implements CharSequence
09: /* #endif */
10: {
11: public String text;
12:
13: // Alternatively have a different subclass for each type.
14: private XStringType type;
15:
16: public XStringType getStringType() {
17: return type;
18: }
19:
20: public char charAt(int index) {
21: return text.charAt(index);
22: }
23:
24: public int length() {
25: return text.length();
26: }
27:
28: /* #ifdef use:java.lang.CharSequence */
29: public CharSequence subSequence(int start, int end) {
30: return text.substring(start, end);
31: }
32:
33: /* #endif */
34:
35: public String toString() {
36: return text;
37: }
38:
39: XString(String text, XStringType type) {
40: this.text = text;
41: this.type = type;
42: }
43: }
|