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
10 /** Package pat can search anything that implements this
\r
11 interface. Package pat assumes the following:
\r
13 <li>The StringLike object will not change. Calls to
\r
14 charAt(int) will not vary with time.
\r
15 <li>The length of the object being searched is known
\r
16 before the search begins and does not vary with time.
\r
18 Note that searching String is probably faster than searching
\r
19 other objects, so searching String is still preferred if
\r
22 public interface StringLike {
\r
23 public char charAt(int i);
\r
24 public String toString();
\r
25 public int length();
\r
26 public String substring(int i1,int i2);
\r
27 /** Obtain the underlying object, be it a String, char[],
\r
28 RandomAccessFile, whatever. */
\r
29 public Object unwrap();
\r
30 /** By default, the result is put in a String or char[]
\r
31 when a replace is done. If you wish to save the result
\r
32 in some other StringBufferLike then you can do this
\r
33 by implementing this method, or over-riding it's behavior
\r
34 from an existing class. */
\r
35 public BasicStringBufferLike newStringBufferLike();
\r
36 public int indexOf(char c);
\r