001: /*
002: * Copyright 1999-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: XMLString.java,v 1.5 2005/07/21 18:08:34 zongaro Exp $
018: */
019: package org.apache.xml.utils;
020:
021: import java.util.Locale;
022:
023: /**
024: * This class is meant to be an interface to character strings, whether they
025: * be java Strings or <code>org.apache.xml.utils.FastStringBuffer</code>s, or
026: * other character data. By using XMLString, character copies can be reduced
027: * in the XML pipeline.
028: */
029: public interface XMLString {
030:
031: /**
032: * Directly call the
033: * characters method on the passed ContentHandler for the
034: * string-value. Multiple calls to the
035: * ContentHandler's characters methods may well occur for a single call to
036: * this method.
037: *
038: * @param ch A non-null reference to a ContentHandler.
039: *
040: * @throws org.xml.sax.SAXException
041: */
042: public abstract void dispatchCharactersEvents(
043: org.xml.sax.ContentHandler ch)
044: throws org.xml.sax.SAXException;
045:
046: /**
047: * Directly call the
048: * comment method on the passed LexicalHandler for the
049: * string-value.
050: *
051: * @param lh A non-null reference to a LexicalHandler.
052: *
053: * @throws org.xml.sax.SAXException
054: */
055: public abstract void dispatchAsComment(
056: org.xml.sax.ext.LexicalHandler lh)
057: throws org.xml.sax.SAXException;
058:
059: /**
060: * Conditionally trim all leading and trailing whitespace in the specified String.
061: * All strings of white space are
062: * replaced by a single space character (#x20), except spaces after punctuation which
063: * receive double spaces if doublePunctuationSpaces is true.
064: * This function may be useful to a formatter, but to get first class
065: * results, the formatter should probably do it's own white space handling
066: * based on the semantics of the formatting object.
067: *
068: * @param trimHead Trim leading whitespace?
069: * @param trimTail Trim trailing whitespace?
070: * @param doublePunctuationSpaces Use double spaces for punctuation?
071: * @return The trimmed string.
072: */
073: public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail,
074: boolean doublePunctuationSpaces);
075:
076: /**
077: * Returns the length of this string.
078: *
079: * @return the length of the sequence of characters represented by this
080: * object.
081: */
082: public abstract int length();
083:
084: /**
085: * Returns the character at the specified index. An index ranges
086: * from <code>0</code> to <code>length() - 1</code>. The first character
087: * of the sequence is at index <code>0</code>, the next at index
088: * <code>1</code>, and so on, as for array indexing.
089: *
090: * @param index the index of the character.
091: * @return the character at the specified index of this string.
092: * The first character is at index <code>0</code>.
093: * @exception IndexOutOfBoundsException if the <code>index</code>
094: * argument is negative or not less than the length of this
095: * string.
096: */
097: public abstract char charAt(int index);
098:
099: /**
100: * Copies characters from this string into the destination character
101: * array.
102: *
103: * @param srcBegin index of the first character in the string
104: * to copy.
105: * @param srcEnd index after the last character in the string
106: * to copy.
107: * @param dst the destination array.
108: * @param dstBegin the start offset in the destination array.
109: * @exception IndexOutOfBoundsException If any of the following
110: * is true:
111: * <ul><li><code>srcBegin</code> is negative.
112: * <li><code>srcBegin</code> is greater than <code>srcEnd</code>
113: * <li><code>srcEnd</code> is greater than the length of this
114: * string
115: * <li><code>dstBegin</code> is negative
116: * <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than
117: * <code>dst.length</code></ul>
118: * @exception NullPointerException if <code>dst</code> is <code>null</code>
119: */
120: public abstract void getChars(int srcBegin, int srcEnd, char dst[],
121: int dstBegin);
122:
123: /**
124: * Compares this string to the specified object.
125: * The result is <code>true</code> if and only if the argument is not
126: * <code>null</code> and is a <code>String</code> object that represents
127: * the same sequence of characters as this object.
128: *
129: * @param anObject the object to compare this <code>String</code>
130: * against.
131: * @return <code>true</code> if the <code>String </code>are equal;
132: * <code>false</code> otherwise.
133: * @see java.lang.String#compareTo(java.lang.String)
134: * @see java.lang.String#equalsIgnoreCase(java.lang.String)
135: */
136: public abstract boolean equals(XMLString anObject);
137:
138: /**
139: * Compares this string to the specified object.
140: * The result is <code>true</code> if and only if the argument is not
141: * <code>null</code> and is a <code>String</code> object that represents
142: * the same sequence of characters as this object.
143: *
144: * @param anObject the object to compare this <code>String</code>
145: * against.
146: * @return <code>true</code> if the <code>String </code>are equal;
147: * <code>false</code> otherwise.
148: * @see java.lang.String#compareTo(java.lang.String)
149: * @see java.lang.String#equalsIgnoreCase(java.lang.String)
150: */
151: public abstract boolean equals(Object anObject);
152:
153: /**
154: * Compares this <code>String</code> to another <code>String</code>,
155: * ignoring case considerations. Two strings are considered equal
156: * ignoring case if they are of the same length, and corresponding
157: * characters in the two strings are equal ignoring case.
158: *
159: * @param anotherString the <code>String</code> to compare this
160: * <code>String</code> against.
161: * @return <code>true</code> if the argument is not <code>null</code>
162: * and the <code>String</code>s are equal,
163: * ignoring case; <code>false</code> otherwise.
164: * @see #equals(Object)
165: * @see java.lang.Character#toLowerCase(char)
166: * @see java.lang.Character#toUpperCase(char)
167: */
168: public abstract boolean equalsIgnoreCase(String anotherString);
169:
170: /**
171: * Compares two strings lexicographically.
172: *
173: * @param anotherString the <code>String</code> to be compared.
174: * @return the value <code>0</code> if the argument string is equal to
175: * this string; a value less than <code>0</code> if this string
176: * is lexicographically less than the string argument; and a
177: * value greater than <code>0</code> if this string is
178: * lexicographically greater than the string argument.
179: * @exception java.lang.NullPointerException if <code>anotherString</code>
180: * is <code>null</code>.
181: */
182: public abstract int compareTo(XMLString anotherString);
183:
184: /**
185: * Compares two strings lexicographically, ignoring case considerations.
186: * This method returns an integer whose sign is that of
187: * <code>this.toUpperCase().toLowerCase().compareTo(
188: * str.toUpperCase().toLowerCase())</code>.
189: * <p>
190: * Note that this method does <em>not</em> take locale into account,
191: * and will result in an unsatisfactory ordering for certain locales.
192: * The java.text package provides <em>collators</em> to allow
193: * locale-sensitive ordering.
194: *
195: * @param str the <code>String</code> to be compared.
196: * @return a negative integer, zero, or a positive integer as the
197: * the specified String is greater than, equal to, or less
198: * than this String, ignoring case considerations.
199: * @see java.text.Collator#compare(String, String)
200: * @since 1.2
201: */
202: public abstract int compareToIgnoreCase(XMLString str);
203:
204: /**
205: * Tests if this string starts with the specified prefix beginning
206: * a specified index.
207: *
208: * @param prefix the prefix.
209: * @param toffset where to begin looking in the string.
210: * @return <code>true</code> if the character sequence represented by the
211: * argument is a prefix of the substring of this object starting
212: * at index <code>toffset</code>; <code>false</code> otherwise.
213: * The result is <code>false</code> if <code>toffset</code> is
214: * negative or greater than the length of this
215: * <code>String</code> object; otherwise the result is the same
216: * as the result of the expression
217: * <pre>
218: * this.subString(toffset).startsWith(prefix)
219: * </pre>
220: * @exception java.lang.NullPointerException if <code>prefix</code> is
221: * <code>null</code>.
222: */
223: public abstract boolean startsWith(String prefix, int toffset);
224:
225: /**
226: * Tests if this string starts with the specified prefix beginning
227: * a specified index.
228: *
229: * @param prefix the prefix.
230: * @param toffset where to begin looking in the string.
231: * @return <code>true</code> if the character sequence represented by the
232: * argument is a prefix of the substring of this object starting
233: * at index <code>toffset</code>; <code>false</code> otherwise.
234: * The result is <code>false</code> if <code>toffset</code> is
235: * negative or greater than the length of this
236: * <code>String</code> object; otherwise the result is the same
237: * as the result of the expression
238: * <pre>
239: * this.subString(toffset).startsWith(prefix)
240: * </pre>
241: * @exception java.lang.NullPointerException if <code>prefix</code> is
242: * <code>null</code>.
243: */
244: public abstract boolean startsWith(XMLString prefix, int toffset);
245:
246: /**
247: * Tests if this string starts with the specified prefix.
248: *
249: * @param prefix the prefix.
250: * @return <code>true</code> if the character sequence represented by the
251: * argument is a prefix of the character sequence represented by
252: * this string; <code>false</code> otherwise.
253: * Note also that <code>true</code> will be returned if the
254: * argument is an empty string or is equal to this
255: * <code>String</code> object as determined by the
256: * {@link #equals(Object)} method.
257: * @exception java.lang.NullPointerException if <code>prefix</code> is
258: * <code>null</code>.
259: * @since JDK1. 0
260: */
261: public abstract boolean startsWith(String prefix);
262:
263: /**
264: * Tests if this string starts with the specified prefix.
265: *
266: * @param prefix the prefix.
267: * @return <code>true</code> if the character sequence represented by the
268: * argument is a prefix of the character sequence represented by
269: * this string; <code>false</code> otherwise.
270: * Note also that <code>true</code> will be returned if the
271: * argument is an empty string or is equal to this
272: * <code>String</code> object as determined by the
273: * {@link #equals(Object)} method.
274: * @exception java.lang.NullPointerException if <code>prefix</code> is
275: * <code>null</code>.
276: * @since JDK1. 0
277: */
278: public abstract boolean startsWith(XMLString prefix);
279:
280: /**
281: * Tests if this string ends with the specified suffix.
282: *
283: * @param suffix the suffix.
284: * @return <code>true</code> if the character sequence represented by the
285: * argument is a suffix of the character sequence represented by
286: * this object; <code>false</code> otherwise. Note that the
287: * result will be <code>true</code> if the argument is the
288: * empty string or is equal to this <code>String</code> object
289: * as determined by the {@link #equals(Object)} method.
290: * @exception java.lang.NullPointerException if <code>suffix</code> is
291: * <code>null</code>.
292: */
293: public abstract boolean endsWith(String suffix);
294:
295: /**
296: * Returns a hashcode for this string. The hashcode for a
297: * <code>String</code> object is computed as
298: * <blockquote><pre>
299: * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
300: * </pre></blockquote>
301: * using <code>int</code> arithmetic, where <code>s[i]</code> is the
302: * <i>i</i>th character of the string, <code>n</code> is the length of
303: * the string, and <code>^</code> indicates exponentiation.
304: * (The hash value of the empty string is zero.)
305: *
306: * @return a hash code value for this object.
307: */
308: public abstract int hashCode();
309:
310: /**
311: * Returns the index within this string of the first occurrence of the
312: * specified character. If a character with value <code>ch</code> occurs
313: * in the character sequence represented by this <code>String</code>
314: * object, then the index of the first such occurrence is returned --
315: * that is, the smallest value <i>k</i> such that:
316: * <blockquote><pre>
317: * this.charAt(<i>k</i>) == ch
318: * </pre></blockquote>
319: * is <code>true</code>. If no such character occurs in this string,
320: * then <code>-1</code> is returned.
321: *
322: * @param ch a character.
323: * @return the index of the first occurrence of the character in the
324: * character sequence represented by this object, or
325: * <code>-1</code> if the character does not occur.
326: */
327: public abstract int indexOf(int ch);
328:
329: /**
330: * Returns the index within this string of the first occurrence of the
331: * specified character, starting the search at the specified index.
332: * <p>
333: * If a character with value <code>ch</code> occurs in the character
334: * sequence represented by this <code>String</code> object at an index
335: * no smaller than <code>fromIndex</code>, then the index of the first
336: * such occurrence is returned--that is, the smallest value <i>k</i>
337: * such that:
338: * <blockquote><pre>
339: * (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
340: * </pre></blockquote>
341: * is true. If no such character occurs in this string at or after
342: * position <code>fromIndex</code>, then <code>-1</code> is returned.
343: * <p>
344: * There is no restriction on the value of <code>fromIndex</code>. If it
345: * is negative, it has the same effect as if it were zero: this entire
346: * string may be searched. If it is greater than the length of this
347: * string, it has the same effect as if it were equal to the length of
348: * this string: <code>-1</code> is returned.
349: *
350: * @param ch a character.
351: * @param fromIndex the index to start the search from.
352: * @return the index of the first occurrence of the character in the
353: * character sequence represented by this object that is greater
354: * than or equal to <code>fromIndex</code>, or <code>-1</code>
355: * if the character does not occur.
356: */
357: public abstract int indexOf(int ch, int fromIndex);
358:
359: /**
360: * Returns the index within this string of the last occurrence of the
361: * specified character. That is, the index returned is the largest
362: * value <i>k</i> such that:
363: * <blockquote><pre>
364: * this.charAt(<i>k</i>) == ch
365: * </pre></blockquote>
366: * is true.
367: * The String is searched backwards starting at the last character.
368: *
369: * @param ch a character.
370: * @return the index of the last occurrence of the character in the
371: * character sequence represented by this object, or
372: * <code>-1</code> if the character does not occur.
373: */
374: public abstract int lastIndexOf(int ch);
375:
376: /**
377: * Returns the index within this string of the last occurrence of the
378: * specified character, searching backward starting at the specified
379: * index. That is, the index returned is the largest value <i>k</i>
380: * such that:
381: * <blockquote><pre>
382: * this.charAt(k) == ch) && (k <= fromIndex)
383: * </pre></blockquote>
384: * is true.
385: *
386: * @param ch a character.
387: * @param fromIndex the index to start the search from. There is no
388: * restriction on the value of <code>fromIndex</code>. If it is
389: * greater than or equal to the length of this string, it has
390: * the same effect as if it were equal to one less than the
391: * length of this string: this entire string may be searched.
392: * If it is negative, it has the same effect as if it were -1:
393: * -1 is returned.
394: * @return the index of the last occurrence of the character in the
395: * character sequence represented by this object that is less
396: * than or equal to <code>fromIndex</code>, or <code>-1</code>
397: * if the character does not occur before that point.
398: */
399: public abstract int lastIndexOf(int ch, int fromIndex);
400:
401: /**
402: * Returns the index within this string of the first occurrence of the
403: * specified substring. The integer returned is the smallest value
404: * <i>k</i> such that:
405: * <blockquote><pre>
406: * this.startsWith(str, <i>k</i>)
407: * </pre></blockquote>
408: * is <code>true</code>.
409: *
410: * @param str any string.
411: * @return if the string argument occurs as a substring within this
412: * object, then the index of the first character of the first
413: * such substring is returned; if it does not occur as a
414: * substring, <code>-1</code> is returned.
415: * @exception java.lang.NullPointerException if <code>str</code> is
416: * <code>null</code>.
417: */
418: public abstract int indexOf(String str);
419:
420: /**
421: * Returns the index within this string of the first occurrence of the
422: * specified substring. The integer returned is the smallest value
423: * <i>k</i> such that:
424: * <blockquote><pre>
425: * this.startsWith(str, <i>k</i>)
426: * </pre></blockquote>
427: * is <code>true</code>.
428: *
429: * @param str any string.
430: * @return if the string argument occurs as a substring within this
431: * object, then the index of the first character of the first
432: * such substring is returned; if it does not occur as a
433: * substring, <code>-1</code> is returned.
434: * @exception java.lang.NullPointerException if <code>str</code> is
435: * <code>null</code>.
436: */
437: public abstract int indexOf(XMLString str);
438:
439: /**
440: * Returns the index within this string of the first occurrence of the
441: * specified substring, starting at the specified index. The integer
442: * returned is the smallest value <i>k</i> such that:
443: * <blockquote><pre>
444: * this.startsWith(str, <i>k</i>) && (<i>k</i> >= fromIndex)
445: * </pre></blockquote>
446: * is <code>true</code>.
447: * <p>
448: * There is no restriction on the value of <code>fromIndex</code>. If
449: * it is negative, it has the same effect as if it were zero: this entire
450: * string may be searched. If it is greater than the length of this
451: * string, it has the same effect as if it were equal to the length of
452: * this string: <code>-1</code> is returned.
453: *
454: * @param str the substring to search for.
455: * @param fromIndex the index to start the search from.
456: * @return If the string argument occurs as a substring within this
457: * object at a starting index no smaller than
458: * <code>fromIndex</code>, then the index of the first character
459: * of the first such substring is returned. If it does not occur
460: * as a substring starting at <code>fromIndex</code> or beyond,
461: * <code>-1</code> is returned.
462: * @exception java.lang.NullPointerException if <code>str</code> is
463: * <code>null</code>
464: */
465: public abstract int indexOf(String str, int fromIndex);
466:
467: /**
468: * Returns the index within this string of the rightmost occurrence
469: * of the specified substring. The rightmost empty string "" is
470: * considered to occur at the index value <code>this.length()</code>.
471: * The returned index is the largest value <i>k</i> such that
472: * <blockquote><pre>
473: * this.startsWith(str, k)
474: * </pre></blockquote>
475: * is true.
476: *
477: * @param str the substring to search for.
478: * @return if the string argument occurs one or more times as a substring
479: * within this object, then the index of the first character of
480: * the last such substring is returned. If it does not occur as
481: * a substring, <code>-1</code> is returned.
482: * @exception java.lang.NullPointerException if <code>str</code> is
483: * <code>null</code>.
484: */
485: public abstract int lastIndexOf(String str);
486:
487: /**
488: * Returns the index within this string of the last occurrence of
489: * the specified substring.
490: *
491: * @param str the substring to search for.
492: * @param fromIndex the index to start the search from. There is no
493: * restriction on the value of fromIndex. If it is greater than
494: * the length of this string, it has the same effect as if it
495: * were equal to the length of this string: this entire string
496: * may be searched. If it is negative, it has the same effect
497: * as if it were -1: -1 is returned.
498: * @return If the string argument occurs one or more times as a substring
499: * within this object at a starting index no greater than
500: * <code>fromIndex</code>, then the index of the first character of
501: * the last such substring is returned. If it does not occur as a
502: * substring starting at <code>fromIndex</code> or earlier,
503: * <code>-1</code> is returned.
504: * @exception java.lang.NullPointerException if <code>str</code> is
505: * <code>null</code>.
506: */
507: public abstract int lastIndexOf(String str, int fromIndex);
508:
509: /**
510: * Returns a new string that is a substring of this string. The
511: * substring begins with the character at the specified index and
512: * extends to the end of this string. <p>
513: * Examples:
514: * <blockquote><pre>
515: * "unhappy".substring(2) returns "happy"
516: * "Harbison".substring(3) returns "bison"
517: * "emptiness".substring(9) returns "" (an empty string)
518: * </pre></blockquote>
519: *
520: * @param beginIndex the beginning index, inclusive.
521: * @return the specified substring.
522: * @exception IndexOutOfBoundsException if
523: * <code>beginIndex</code> is negative or larger than the
524: * length of this <code>String</code> object.
525: */
526: public abstract XMLString substring(int beginIndex);
527:
528: /**
529: * Returns a new string that is a substring of this string. The
530: * substring begins at the specified <code>beginIndex</code> and
531: * extends to the character at index <code>endIndex - 1</code>.
532: * Thus the length of the substring is <code>endIndex-beginIndex</code>.
533: *
534: * @param beginIndex the beginning index, inclusive.
535: * @param endIndex the ending index, exclusive.
536: * @return the specified substring.
537: * @exception IndexOutOfBoundsException if the
538: * <code>beginIndex</code> is negative, or
539: * <code>endIndex</code> is larger than the length of
540: * this <code>String</code> object, or
541: * <code>beginIndex</code> is larger than
542: * <code>endIndex</code>.
543: */
544: public abstract XMLString substring(int beginIndex, int endIndex);
545:
546: /**
547: * Concatenates the specified string to the end of this string.
548: *
549: * @param str the <code>String</code> that is concatenated to the end
550: * of this <code>String</code>.
551: * @return a string that represents the concatenation of this object's
552: * characters followed by the string argument's characters.
553: * @exception java.lang.NullPointerException if <code>str</code> is
554: * <code>null</code>.
555: */
556: public abstract XMLString concat(String str);
557:
558: /**
559: * Converts all of the characters in this <code>String</code> to lower
560: * case using the rules of the given <code>Locale</code>.
561: *
562: * @param locale use the case transformation rules for this locale
563: * @return the String, converted to lowercase.
564: * @see java.lang.Character#toLowerCase(char)
565: * @see java.lang.String#toUpperCase(Locale)
566: */
567: public abstract XMLString toLowerCase(Locale locale);
568:
569: /**
570: * Converts all of the characters in this <code>String</code> to lower
571: * case using the rules of the default locale, which is returned
572: * by <code>Locale.getDefault</code>.
573: * <p>
574: *
575: * @return the string, converted to lowercase.
576: * @see java.lang.Character#toLowerCase(char)
577: * @see java.lang.String#toLowerCase(Locale)
578: */
579: public abstract XMLString toLowerCase();
580:
581: /**
582: * Converts all of the characters in this <code>String</code> to upper
583: * case using the rules of the given locale.
584: * @param locale use the case transformation rules for this locale
585: * @return the String, converted to uppercase.
586: * @see java.lang.Character#toUpperCase(char)
587: * @see java.lang.String#toLowerCase(Locale)
588: */
589: public abstract XMLString toUpperCase(Locale locale);
590:
591: /**
592: * Converts all of the characters in this <code>String</code> to upper
593: * case using the rules of the default locale, which is returned
594: * by <code>Locale.getDefault</code>.
595: *
596: * <p>
597: * If no character in this string has a different uppercase version,
598: * based on calling the <code>toUpperCase</code> method defined by
599: * <code>Character</code>, then the original string is returned.
600: * <p>
601: * Otherwise, this method creates a new <code>String</code> object
602: * representing a character sequence identical in length to the
603: * character sequence represented by this <code>String</code> object and
604: * with every character equal to the result of applying the method
605: * <code>Character.toUpperCase</code> to the corresponding character of
606: * this <code>String</code> object. <p>
607: * Examples:
608: * <blockquote><pre>
609: * "Fahrvergnügen".toUpperCase() returns "FAHRVERGNÜGEN"
610: * "Visit Ljubinje!".toUpperCase() returns "VISIT LJUBINJE!"
611: * </pre></blockquote>
612: *
613: * @return the string, converted to uppercase.
614: * @see java.lang.Character#toUpperCase(char)
615: * @see java.lang.String#toUpperCase(Locale)
616: */
617: public abstract XMLString toUpperCase();
618:
619: /**
620: * Removes white space from both ends of this string.
621: * <p>
622: * If this <code>String</code> object represents an empty character
623: * sequence, or the first and last characters of character sequence
624: * represented by this <code>String</code> object both have codes
625: * greater than <code>'\u0020'</code> (the space character), then a
626: * reference to this <code>String</code> object is returned.
627: * <p>
628: * Otherwise, if there is no character with a code greater than
629: * <code>'\u0020'</code> in the string, then a new
630: * <code>String</code> object representing an empty string is created
631: * and returned.
632: * <p>
633: * Otherwise, let <i>k</i> be the index of the first character in the
634: * string whose code is greater than <code>'\u0020'</code>, and let
635: * <i>m</i> be the index of the last character in the string whose code
636: * is greater than <code>'\u0020'</code>. A new <code>String</code>
637: * object is created, representing the substring of this string that
638: * begins with the character at index <i>k</i> and ends with the
639: * character at index <i>m</i>-that is, the result of
640: * <code>this.substring(<i>k</i>, <i>m</i>+1)</code>.
641: * <p>
642: * This method may be used to trim
643: * {@link Character#isSpace(char) whitespace} from the beginning and end
644: * of a string; in fact, it trims all ASCII control characters as well.
645: *
646: * @return this string, with white space removed from the front and end.
647: */
648: public abstract XMLString trim();
649:
650: /**
651: * This object (which is already a string!) is itself returned.
652: *
653: * @return the string itself.
654: */
655: public abstract String toString();
656:
657: /**
658: * Tell if this object contains a java String object.
659: *
660: * @return true if this XMLString can return a string without creating one.
661: */
662: public abstract boolean hasString();
663:
664: /**
665: * Convert a string to a double -- Allowed input is in fixed
666: * notation ddd.fff.
667: *
668: * @return A double value representation of the string, or return Double.NaN
669: * if the string can not be converted.
670: */
671: public double toDouble();
672: }
|