Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 16:01:40 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  11618 toggle public StringWrap(String s)
22    {
23  11618 this.s = s;
24    }
25   
 
26  152 toggle public String toString()
27    {
28  152 return s;
29    }
30   
 
31  1075139 toggle public char charAt(int i)
32    {
33  1075139 return s.charAt(i);
34    }
35   
 
36  950140 toggle public int length()
37    {
38  950140 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  21351 toggle public Object unwrap()
47    {
48  21351 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    }