Clover icon

Coverage Report

  1. Project Clover database Wed Nov 13 2024 16:21:17 GMT
  2. Package com.stevesoft.pat

File StringLike.java

 

Code metrics

0
0
0
1
47
12
0
-
-
0
-

Classes

Class Line # Actions
StringLike 22 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

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