needed for applet search
[jalview.git] / src / com / stevesoft / pat / StringLike.java
diff --git a/src/com/stevesoft/pat/StringLike.java b/src/com/stevesoft/pat/StringLike.java
new file mode 100755 (executable)
index 0000000..a6cd318
--- /dev/null
@@ -0,0 +1,37 @@
+package//\r
+// This software is now distributed according to\r
+// the Lesser Gnu Public License.  Please see\r
+// http://www.gnu.org/copyleft/lesser.txt for\r
+// the details.\r
+//    -- Happy Computing!\r
+//\r
+com.stevesoft.pat;\r
+\r
+/** Package pat can search anything that implements this\r
+    interface.  Package pat assumes the following:\r
+    <ul>\r
+    <li>The StringLike object will not change.  Calls to\r
+        charAt(int) will not vary with time.\r
+    <li>The length of the object being searched is known\r
+        before the search begins and does not vary with time.\r
+    </ul>\r
+    Note that searching String is probably faster than searching\r
+    other objects, so searching String is still preferred if\r
+    possible.\r
+*/\r
+public interface StringLike {\r
+    public char charAt(int i);\r
+    public String toString();\r
+    public int length();\r
+    public String substring(int i1,int i2);\r
+    /** Obtain the underlying object, be it a String, char[],\r
+        RandomAccessFile, whatever. */\r
+    public Object unwrap();\r
+    /** By default, the result is put in a String or char[]\r
+        when a replace is done.  If you wish to save the result\r
+        in some other StringBufferLike then you can do this\r
+        by implementing this method, or over-riding it's behavior\r
+        from an existing class. */\r
+    public BasicStringBufferLike newStringBufferLike();\r
+    public int indexOf(char c);\r
+}\r