19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file
49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information
59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file
69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License.
89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at
99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software
139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and
169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License.
179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: XMLString.java 570109 2007-08-27 13:31:35Z zongaro $
209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xml.utils;
229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport java.util.Locale;
249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/**
269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This class is meant to be an interface to character strings, whether they
279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be java Strings or <code>org.apache.xml.utils.FastStringBuffer</code>s, or
289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * other character data.  By using XMLString, character copies can be reduced
299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * in the XML pipeline.
309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic interface XMLString
329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{
339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Directly call the
369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * characters method on the passed ContentHandler for the
379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string-value. Multiple calls to the
389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * ContentHandler's characters methods may well occur for a single call to
399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this method.
409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param ch A non-null reference to a ContentHandler.
429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract void dispatchCharactersEvents(org.xml.sax.ContentHandler ch)
469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    throws org.xml.sax.SAXException;
479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Directly call the
509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * comment method on the passed LexicalHandler for the
519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string-value.
529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param lh A non-null reference to a LexicalHandler.
549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract void dispatchAsComment(org.xml.sax.ext.LexicalHandler lh)
589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    throws org.xml.sax.SAXException;
599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Conditionally trim all leading and trailing whitespace in the specified String.
629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * All strings of white space are
639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * replaced by a single space character (#x20), except spaces after punctuation which
649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * receive double spaces if doublePunctuationSpaces is true.
659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * This function may be useful to a formatter, but to get first class
669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * results, the formatter should probably do it's own white space handling
679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * based on the semantics of the formatting object.
689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   trimHead    Trim leading whitespace?
709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   trimTail    Trim trailing whitespace?
719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   doublePunctuationSpaces    Use double spaces for punctuation?
729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return              The trimmed string.
739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public XMLString fixWhiteSpace(boolean trimHead,
759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                                 boolean trimTail,
769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                                 boolean doublePunctuationSpaces);
779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the length of this string.
809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the length of the sequence of characters represented by this
829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          object.
839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int length();
859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the character at the specified index. An index ranges
889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * from <code>0</code> to <code>length() - 1</code>. The first character
899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * of the sequence is at index <code>0</code>, the next at index
909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>1</code>, and so on, as for array indexing.
919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      index   the index of the character.
939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return     the character at the specified index of this string.
949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             The first character is at index <code>0</code>.
959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception  IndexOutOfBoundsException  if the <code>index</code>
969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             argument is negative or not less than the length of this
979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             string.
989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract char charAt(int index);
1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Copies characters from this string into the destination character
1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * array.
1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      srcBegin   index of the first character in the string
1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                        to copy.
1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      srcEnd     index after the last character in the string
1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                        to copy.
1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      dst        the destination array.
1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      dstBegin   the start offset in the destination array.
1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception IndexOutOfBoundsException If any of the following
1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            is true:
1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            <ul><li><code>srcBegin</code> is negative.
1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            <li><code>srcBegin</code> is greater than <code>srcEnd</code>
1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            <li><code>srcEnd</code> is greater than the length of this
1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                string
1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            <li><code>dstBegin</code> is negative
1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than
1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                <code>dst.length</code></ul>
1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception NullPointerException if <code>dst</code> is <code>null</code>
1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract void getChars(int srcBegin, int srcEnd, char dst[],
1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                                int dstBegin);
1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Compares this string to the specified object.
1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The result is <code>true</code> if and only if the argument is not
1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>null</code> and is an <code>XMLString</code> object that represents
1299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the same sequence of characters as this object.
1309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   anObject   the object to compare this <code>String</code>
1329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                     against.
1339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the <code>String </code>are equal;
1349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>false</code> otherwise.
1359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#compareTo(java.lang.String)
1369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
1379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean equals(XMLString anObject);
1399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Compares this string to the specified <code>String</code>.
1429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The result is <code>true</code> if and only if the argument is not
1439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>null</code> and is a <code>String</code> object that represents
1449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the same sequence of characters as this object.
1459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   anotherString   the object to compare this <code>String</code>
1479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                          against.
1489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the <code>String</code>s are equal;
1499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>false</code> otherwise.
1509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#compareTo(java.lang.String)
1519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
1529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean equals(String anotherString);
1549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Compares this string to the specified object.
1579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The result is <code>true</code> if and only if the argument is not
1589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>null</code> and is a <code>String</code> object that represents
1599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the same sequence of characters as this object.
1609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   anObject   the object to compare this <code>String</code>
1629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                     against.
1639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the <code>String </code>are equal;
1649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>false</code> otherwise.
1659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#compareTo(java.lang.String)
1669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#equalsIgnoreCase(java.lang.String)
1679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean equals(Object anObject);
1699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Compares this <code>String</code> to another <code>String</code>,
1729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * ignoring case considerations.  Two strings are considered equal
1739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * ignoring case if they are of the same length, and corresponding
1749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * characters in the two strings are equal ignoring case.
1759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   anotherString   the <code>String</code> to compare this
1779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                          <code>String</code> against.
1789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the argument is not <code>null</code>
1799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          and the <code>String</code>s are equal,
1809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          ignoring case; <code>false</code> otherwise.
1819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     #equals(Object)
1829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.Character#toLowerCase(char)
1839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see java.lang.Character#toUpperCase(char)
1849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean equalsIgnoreCase(String anotherString);
1869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Compares two strings lexicographically.
1899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   anotherString   the <code>String</code> to be compared.
1919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the value <code>0</code> if the argument string is equal to
1929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          this string; a value less than <code>0</code> if this string
1939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          is lexicographically less than the string argument; and a
1949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          value greater than <code>0</code> if this string is
1959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          lexicographically greater than the string argument.
1969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>anotherString</code>
1979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          is <code>null</code>.
1989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int compareTo(XMLString anotherString);
2009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Compares two strings lexicographically, ignoring case considerations.
2039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * This method returns an integer whose sign is that of
2049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>this.toUpperCase().toLowerCase().compareTo(
2059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * str.toUpperCase().toLowerCase())</code>.
2069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
2079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Note that this method does <em>not</em> take locale into account,
2089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * and will result in an unsatisfactory ordering for certain locales.
2099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The java.text package provides <em>collators</em> to allow
2109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * locale-sensitive ordering.
2119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str   the <code>String</code> to be compared.
2139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  a negative integer, zero, or a positive integer as the
2149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          the specified String is greater than, equal to, or less
2159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          than this String, ignoring case considerations.
2169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.text.Collator#compare(String, String)
2179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @since   1.2
2189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
2199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int compareToIgnoreCase(XMLString str);
2209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Tests if this string starts with the specified prefix beginning
2239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * a specified index.
2249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   prefix    the prefix.
2269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   toffset   where to begin looking in the string.
2279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the character sequence represented by the
2289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is a prefix of the substring of this object starting
2299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          at index <code>toffset</code>; <code>false</code> otherwise.
2309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          The result is <code>false</code> if <code>toffset</code> is
2319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          negative or greater than the length of this
2329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>String</code> object; otherwise the result is the same
2339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          as the result of the expression
2349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <pre>
2359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          this.subString(toffset).startsWith(prefix)
2369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          </pre>
2379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>prefix</code> is
2389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
2399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
2409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean startsWith(String prefix, int toffset);
2419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Tests if this string starts with the specified prefix beginning
2449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * a specified index.
2459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   prefix    the prefix.
2479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   toffset   where to begin looking in the string.
2489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the character sequence represented by the
2499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is a prefix of the substring of this object starting
2509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          at index <code>toffset</code>; <code>false</code> otherwise.
2519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          The result is <code>false</code> if <code>toffset</code> is
2529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          negative or greater than the length of this
2539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>String</code> object; otherwise the result is the same
2549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          as the result of the expression
2559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <pre>
2569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          this.subString(toffset).startsWith(prefix)
2579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          </pre>
2589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>prefix</code> is
2599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
2609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
2619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean startsWith(XMLString prefix, int toffset);
2629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Tests if this string starts with the specified prefix.
2659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   prefix   the prefix.
2679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the character sequence represented by the
2689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is a prefix of the character sequence represented by
2699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          this string; <code>false</code> otherwise.
2709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          Note also that <code>true</code> will be returned if the
2719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is an empty string or is equal to this
2729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>String</code> object as determined by the
2739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          {@link #equals(Object)} method.
2749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>prefix</code> is
2759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
2769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @since   JDK1. 0
2779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
2789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean startsWith(String prefix);
2799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Tests if this string starts with the specified prefix.
2829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   prefix   the prefix.
2849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the character sequence represented by the
2859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is a prefix of the character sequence represented by
2869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          this string; <code>false</code> otherwise.
2879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          Note also that <code>true</code> will be returned if the
2889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is an empty string or is equal to this
2899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>String</code> object as determined by the
2909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          {@link #equals(Object)} method.
2919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>prefix</code> is
2929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
2939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @since   JDK1. 0
2949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
2959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean startsWith(XMLString prefix);
2969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Tests if this string ends with the specified suffix.
2999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   suffix   the suffix.
3019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  <code>true</code> if the character sequence represented by the
3029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          argument is a suffix of the character sequence represented by
3039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          this object; <code>false</code> otherwise. Note that the
3049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          result will be <code>true</code> if the argument is the
3059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          empty string or is equal to this <code>String</code> object
3069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          as determined by the {@link #equals(Object)} method.
3079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>suffix</code> is
3089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
3099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
3109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean endsWith(String suffix);
3119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns a hashcode for this string. The hashcode for a
3149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>String</code> object is computed as
3159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
3169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
3179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
3189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * using <code>int</code> arithmetic, where <code>s[i]</code> is the
3199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <i>i</i>th character of the string, <code>n</code> is the length of
3209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the string, and <code>^</code> indicates exponentiation.
3219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * (The hash value of the empty string is zero.)
3229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  a hash code value for this object.
3249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
3259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int hashCode();
3269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the first occurrence of the
3299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified character. If a character with value <code>ch</code> occurs
3309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * in the character sequence represented by this <code>String</code>
3319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * object, then the index of the first such occurrence is returned --
3329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * that is, the smallest value <i>k</i> such that:
3339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
3349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.charAt(<i>k</i>) == ch
3359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
3369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is <code>true</code>. If no such character occurs in this string,
3379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * then <code>-1</code> is returned.
3389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   ch   a character.
3409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the index of the first occurrence of the character in the
3419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          character sequence represented by this object, or
3429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>-1</code> if the character does not occur.
3439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
3449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int indexOf(int ch);
3459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the first occurrence of the
3489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified character, starting the search at the specified index.
3499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
3509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * If a character with value <code>ch</code> occurs in the character
3519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * sequence represented by this <code>String</code> object at an index
3529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * no smaller than <code>fromIndex</code>, then the index of the first
3539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * such occurrence is returned--that is, the smallest value <i>k</i>
3549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * such that:
3559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
3569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
3579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
3589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is true. If no such character occurs in this string at or after
3599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * position <code>fromIndex</code>, then <code>-1</code> is returned.
3609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
3619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * There is no restriction on the value of <code>fromIndex</code>. If it
3629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is negative, it has the same effect as if it were zero: this entire
3639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string may be searched. If it is greater than the length of this
3649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string, it has the same effect as if it were equal to the length of
3659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this string: <code>-1</code> is returned.
3669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   ch          a character.
3689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   fromIndex   the index to start the search from.
3699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the index of the first occurrence of the character in the
3709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          character sequence represented by this object that is greater
3719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          than or equal to <code>fromIndex</code>, or <code>-1</code>
3729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          if the character does not occur.
3739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
3749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int indexOf(int ch, int fromIndex);
3759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the last occurrence of the
3789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified character. That is, the index returned is the largest
3799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * value <i>k</i> such that:
3809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
3819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.charAt(<i>k</i>) == ch
3829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
3839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is true.
3849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The String is searched backwards starting at the last character.
3859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   ch   a character.
3879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the index of the last occurrence of the character in the
3889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          character sequence represented by this object, or
3899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>-1</code> if the character does not occur.
3909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
3919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int lastIndexOf(int ch);
3929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the last occurrence of the
3959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified character, searching backward starting at the specified
3969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * index. That is, the index returned is the largest value <i>k</i>
3979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * such that:
3989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
3999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.charAt(k) == ch) && (k <= fromIndex)
4009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
4019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is true.
4029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   ch          a character.
4049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   fromIndex   the index to start the search from. There is no
4059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          restriction on the value of <code>fromIndex</code>. If it is
4069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          greater than or equal to the length of this string, it has
4079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          the same effect as if it were equal to one less than the
4089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          length of this string: this entire string may be searched.
4099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          If it is negative, it has the same effect as if it were -1:
4109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          -1 is returned.
4119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the index of the last occurrence of the character in the
4129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          character sequence represented by this object that is less
4139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          than or equal to <code>fromIndex</code>, or <code>-1</code>
4149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          if the character does not occur before that point.
4159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int lastIndexOf(int ch, int fromIndex);
4179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the first occurrence of the
4209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified substring. The integer returned is the smallest value
4219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <i>k</i> such that:
4229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
4239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.startsWith(str, <i>k</i>)
4249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
4259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is <code>true</code>.
4269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str   any string.
4289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  if the string argument occurs as a substring within this
4299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          object, then the index of the first character of the first
4309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          such substring is returned; if it does not occur as a
4319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          substring, <code>-1</code> is returned.
4329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>str</code> is
4339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
4349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int indexOf(String str);
4369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the first occurrence of the
4399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified substring. The integer returned is the smallest value
4409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <i>k</i> such that:
4419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
4429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.startsWith(str, <i>k</i>)
4439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
4449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is <code>true</code>.
4459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str   any string.
4479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  if the string argument occurs as a substring within this
4489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          object, then the index of the first character of the first
4499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          such substring is returned; if it does not occur as a
4509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          substring, <code>-1</code> is returned.
4519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>str</code> is
4529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
4539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int indexOf(XMLString str);
4559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the first occurrence of the
4589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * specified substring, starting at the specified index. The integer
4599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * returned is the smallest value <i>k</i> such that:
4609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
4619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.startsWith(str, <i>k</i>) && (<i>k</i> >= fromIndex)
4629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
4639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is <code>true</code>.
4649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
4659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * There is no restriction on the value of <code>fromIndex</code>. If
4669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * it is negative, it has the same effect as if it were zero: this entire
4679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string may be searched. If it is greater than the length of this
4689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string, it has the same effect as if it were equal to the length of
4699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this string: <code>-1</code> is returned.
4709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str         the substring to search for.
4729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   fromIndex   the index to start the search from.
4739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  If the string argument occurs as a substring within this
4749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          object at a starting index no smaller than
4759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>fromIndex</code>, then the index of the first character
4769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          of the first such substring is returned. If it does not occur
4779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          as a substring starting at <code>fromIndex</code> or beyond,
4789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>-1</code> is returned.
4799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>str</code> is
4809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>
4819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int indexOf(String str, int fromIndex);
4839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the rightmost occurrence
4869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * of the specified substring.  The rightmost empty string "" is
4879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * considered to occur at the index value <code>this.length()</code>.
4889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The returned index is the largest value <i>k</i> such that
4899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
4909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this.startsWith(str, k)
4919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
4929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is true.
4939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str   the substring to search for.
4959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  if the string argument occurs one or more times as a substring
4969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          within this object, then the index of the first character of
4979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          the last such substring is returned. If it does not occur as
4989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          a substring, <code>-1</code> is returned.
4999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException  if <code>str</code> is
5009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
5019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int lastIndexOf(String str);
5039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns the index within this string of the last occurrence of
5069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the specified substring.
5079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str         the substring to search for.
5099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   fromIndex   the index to start the search from. There is no
5109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          restriction on the value of fromIndex. If it is greater than
5119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          the length of this string, it has the same effect as if it
5129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          were equal to the length of this string: this entire string
5139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          may be searched. If it is negative, it has the same effect
5149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          as if it were -1: -1 is returned.
5159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  If the string argument occurs one or more times as a substring
5169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          within this object at a starting index no greater than
5179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>fromIndex</code>, then the index of the first character of
5189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          the last such substring is returned. If it does not occur as a
5199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          substring starting at <code>fromIndex</code> or earlier,
5209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>-1</code> is returned.
5219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>str</code> is
5229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
5239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract int lastIndexOf(String str, int fromIndex);
5259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns a new string that is a substring of this string. The
5289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * substring begins with the character at the specified index and
5299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * extends to the end of this string. <p>
5309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Examples:
5319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
5329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * "unhappy".substring(2) returns "happy"
5339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * "Harbison".substring(3) returns "bison"
5349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * "emptiness".substring(9) returns "" (an empty string)
5359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
5369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      beginIndex   the beginning index, inclusive.
5389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return     the specified substring.
5399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception  IndexOutOfBoundsException  if
5409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             <code>beginIndex</code> is negative or larger than the
5419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             length of this <code>String</code> object.
5429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString substring(int beginIndex);
5449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Returns a new string that is a substring of this string. The
5479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * substring begins at the specified <code>beginIndex</code> and
5489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * extends to the character at index <code>endIndex - 1</code>.
5499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Thus the length of the substring is <code>endIndex-beginIndex</code>.
5509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      beginIndex   the beginning index, inclusive.
5529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param      endIndex     the ending index, exclusive.
5539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return     the specified substring.
5549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception  IndexOutOfBoundsException  if the
5559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             <code>beginIndex</code> is negative, or
5569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             <code>endIndex</code> is larger than the length of
5579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             this <code>String</code> object, or
5589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             <code>beginIndex</code> is larger than
5599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *             <code>endIndex</code>.
5609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString substring(int beginIndex, int endIndex);
5629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Concatenates the specified string to the end of this string.
5659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   str   the <code>String</code> that is concatenated to the end
5679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *                of this <code>String</code>.
5689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  a string that represents the concatenation of this object's
5699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          characters followed by the string argument's characters.
5709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @exception java.lang.NullPointerException if <code>str</code> is
5719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *          <code>null</code>.
5729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString concat(String str);
5749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Converts all of the characters in this <code>String</code> to lower
5779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * case using the rules of the given <code>Locale</code>.
5789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param locale use the case transformation rules for this locale
5809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return the String, converted to lowercase.
5819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.Character#toLowerCase(char)
5829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#toUpperCase(Locale)
5839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString toLowerCase(Locale locale);
5859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Converts all of the characters in this <code>String</code> to lower
5889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * case using the rules of the default locale, which is returned
5899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * by <code>Locale.getDefault</code>.
5909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
5919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the string, converted to lowercase.
5939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.Character#toLowerCase(char)
5949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#toLowerCase(Locale)
5959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString toLowerCase();
5979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Converts all of the characters in this <code>String</code> to upper
6009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * case using the rules of the given locale.
6019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param locale use the case transformation rules for this locale
6029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return the String, converted to uppercase.
6039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.Character#toUpperCase(char)
6049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#toLowerCase(Locale)
6059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
6069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString toUpperCase(Locale locale);
6079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
6099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Converts all of the characters in this <code>String</code> to upper
6109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * case using the rules of the default locale, which is returned
6119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * by <code>Locale.getDefault</code>.
6129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
6139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
6149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * If no character in this string has a different uppercase version,
6159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * based on calling the <code>toUpperCase</code> method defined by
6169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>Character</code>, then the original string is returned.
6179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
6189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Otherwise, this method creates a new <code>String</code> object
6199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * representing a character sequence identical in length to the
6209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * character sequence represented by this <code>String</code> object and
6219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * with every character equal to the result of applying the method
6229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>Character.toUpperCase</code> to the corresponding character of
6239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * this <code>String</code> object. <p>
6249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Examples:
6259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <blockquote><pre>
6269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * "Fahrvergn&uuml;gen".toUpperCase() returns "FAHRVERGN&Uuml;GEN"
6279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * "Visit Ljubinje!".toUpperCase() returns "VISIT LJUBINJE!"
6289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * </pre></blockquote>
6299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
6309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the string, converted to uppercase.
6319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.Character#toUpperCase(char)
6329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see     java.lang.String#toUpperCase(Locale)
6339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
6349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString toUpperCase();
6359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
6379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Removes white space from both ends of this string.
6389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
6399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * If this <code>String</code> object represents an empty character
6409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * sequence, or the first and last characters of character sequence
6419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * represented by this <code>String</code> object both have codes
6429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * greater than <code>'&#92;u0020'</code> (the space character), then a
6439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * reference to this <code>String</code> object is returned.
6449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
6459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Otherwise, if there is no character with a code greater than
6469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>'&#92;u0020'</code> in the string, then a new
6479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>String</code> object representing an empty string is created
6489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * and returned.
6499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
6509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Otherwise, let <i>k</i> be the index of the first character in the
6519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * string whose code is greater than <code>'&#92;u0020'</code>, and let
6529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <i>m</i> be the index of the last character in the string whose code
6539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * is greater than <code>'&#92;u0020'</code>. A new <code>String</code>
6549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * object is created, representing the substring of this string that
6559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * begins with the character at index <i>k</i> and ends with the
6569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * character at index <i>m</i>-that is, the result of
6579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <code>this.substring(<i>k</i>,&nbsp;<i>m</i>+1)</code>.
6589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>
6599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * This method may be used to trim
6609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * {@link Character#isSpace(char) whitespace} from the beginning and end
6619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * of a string; in fact, it trims all ASCII control characters as well.
6629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
6639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  this string, with white space removed from the front and end.
6649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
6659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract XMLString trim();
6669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
6689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * This object (which is already a string!) is itself returned.
6699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
6709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return  the string itself.
6719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
6729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract String toString();
6739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
6759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Tell if this object contains a java String object.
6769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
6779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return true if this XMLString can return a string without creating one.
6789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
6799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public abstract boolean hasString();
6809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
6829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Convert a string to a double -- Allowed input is in fixed
6839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * notation ddd.fff.
6849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
6859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return A double value representation of the string, or return Double.NaN
6869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * if the string can not be converted.
6879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
6889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public double toDouble();
6899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson}
690