JAL-1807 still testing
[jalviewjs.git] / unused / com / stevesoft / pat / StringLike.java
1 package //\r
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
5 // the details.\r
6 //    -- Happy Computing!\r
7 //\r
8 com.stevesoft.pat;\r
9 \r
10 /**\r
11  * Package pat can search anything that implements this interface. Package pat\r
12  * assumes the following:\r
13  * <ul>\r
14  * <li>The StringLike object will not change. Calls to charAt(int) will not\r
15  * vary with time.\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
18  * </ul>\r
19  * Note that searching String is probably faster than searching other objects,\r
20  * so searching String is still preferred if possible.\r
21  */\r
22 public interface StringLike\r
23 {\r
24   public char charAt(int i);\r
25 \r
26   public String toString();\r
27 \r
28   public int length();\r
29 \r
30   public String substring(int i1, int i2);\r
31 \r
32   /**\r
33    * Obtain the underlying object, be it a String, char[], RandomAccessFile,\r
34    * whatever.\r
35    */\r
36   public Object unwrap();\r
37 \r
38   /**\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
42    * existing class.\r
43    */\r
44   public BasicStringBufferLike newStringBufferLike();\r
45 \r
46   public int indexOf(char c);\r
47 }\r