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