Clover icon

Coverage Report

  1. Project Clover database Thu Aug 13 2020 12:04:21 BST
  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 44 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  10357 toggle public StringWrap(String s)
22    {
23  10357 this.s = s;
24    }
25   
 
26  47 toggle public String toString()
27    {
28  47 return s;
29    }
30   
 
31  857065 toggle public char charAt(int i)
32    {
33  857065 return s.charAt(i);
34    }
35   
 
36  699515 toggle public int length()
37    {
38  699515 return s.length();
39    }
40   
 
41  13020 toggle public String substring(int i1, int i2)
42    {
43  13020 return s.substring(i1, i2);
44    }
45   
 
46  19432 toggle public Object unwrap()
47    {
48  19432 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    }