Clover icon

Coverage Report

  1. Project Clover database Thu Aug 13 2020 12:04:21 BST
  2. Package com.stevesoft.pat

File Skip2.java

 

Coverage histogram

../../../img/srcFileCovDistChart8.png
20% of files have more coverage

Code metrics

10
15
2
1
57
39
9
0.6
7.5
2
4.5

Classes

Class Line # Actions
Skip2 17 15 9
0.777777877.8%
 

Contributing tests

This file is covered by 11 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;
9   
10    /**
11    * This is the same as Skip, except it needs a minimum of two characters in the
12    * initializing String.
13    *
14    * @see com.stevesoft.pat.Skip
15    * @see com.stevesoft.pat.SkipBMH
16    */
 
17    public class Skip2 extends Skip
18    {
19    int c1, mask1;
20   
 
21  42 toggle public Skip2(String s, boolean ign, int offset)
22    {
23  42 super(s, ign, offset);
24  42 c1 = s.charAt(1);
25  42 m1 = 2 == s.length();
26  42 if (ign)
27    {
28  0 mask1 = mkmask(c1);
29    }
30    else
31    {
32  42 mask1 = 0;
33    }
34    }
35   
 
36  127202 toggle public int find(StringLike s, int start, int end)
37    {
38  127202 if (start > end)
39    {
40  0 return -1;
41    }
42  127202 start += offset;
43  127202 int vend = min(s.length() - 2, end + offset);
44  127202 for (int i = start; i <= vend; i++)
45    {
46  126292 if (0 == (s.charAt(i) & mask) && 0 == (s.charAt(i + 1) & mask1))
47    {
48    // if(m1||s.regionMatches(ign,i,src,0,src.length()) )
49  126292 if (m1 || CaseMgr.regionMatches(s, ign, i, src, 0, src.length()))
50    {
51  126292 return i - offset;
52    }
53    }
54    }
55  910 return -1;
56    }
57    }