1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package com.stevesoft.pat.wrap

File StringWrap.java

 

Coverage histogram

../../../../img/srcFileCovDistChart9.png
12% of files have more coverage

Code metrics

0
8
8
1
60
39
8
1
1
8
1

Classes

Class
Line #
Actions
StringWrap 17 8 8
0.87587.5%
 

Contributing tests

This file is covered by 81 tests. .

Source view

1    //
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    package com.stevesoft.pat.wrap;
9   
10    import com.stevesoft.pat.BasicStringBufferLike;
11    import com.stevesoft.pat.StringLike;
12   
13    /**
14    * A basic wrapper for the String object. Regex does not search String directly
15    * any longer, it searches StringLike.
16    */
 
17    public class StringWrap implements StringLike
18    {
19    String s;
20   
 
21  11616 toggle public StringWrap(String s)
22    {
23  11616 this.s = s;
24    }
25   
 
26  152 toggle public String toString()
27    {
28  152 return s;
29    }
30   
 
31  1075129 toggle public char charAt(int i)
32    {
33  1075129 return s.charAt(i);
34    }
35   
 
36  950128 toggle public int length()
37    {
38  950128 return s.length();
39    }
40   
 
41  13402 toggle public String substring(int i1, int i2)
42    {
43  13402 return s.substring(i1, i2);
44    }
45   
 
46  21349 toggle public Object unwrap()
47    {
48  21349 return s;
49    }
50   
 
51  3 toggle public BasicStringBufferLike newStringBufferLike()
52    {
53  3 return new StringBufferWrap();
54    }
55   
 
56  0 toggle public int indexOf(char c)
57    {
58  0 return s.indexOf(c);
59    }
60    }