2 // This software is now distributed according to
\r
3 // the Lesser Gnu Public License. Please see
\r
4 // http://www.gnu.org/copyleft/lesser.txt for
\r
6 // -- Happy Computing!
\r
11 * Package pat can search anything that implements this interface. Package pat
\r
12 * assumes the following:
\r
14 * <li>The StringLike object will not change. Calls to charAt(int) will not
\r
16 * <li>The length of the object being searched is known before the search
\r
17 * begins and does not vary with time.
\r
19 * Note that searching String is probably faster than searching other objects,
\r
20 * so searching String is still preferred if possible.
\r
22 public interface StringLike
\r
24 public char charAt(int i);
\r
26 public String toString();
\r
28 public int length();
\r
30 public String substring(int i1, int i2);
\r
33 * Obtain the underlying object, be it a String, char[], RandomAccessFile,
\r
36 public Object unwrap();
\r
39 * By default, the result is put in a String or char[] when a replace is done.
\r
40 * If you wish to save the result in some other StringBufferLike then you can
\r
41 * do this by implementing this method, or over-riding it's behavior from an
\r
44 public BasicStringBufferLike newStringBufferLike();
\r
46 public int indexOf(char c);
\r