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

File Skip2.java

 

Coverage histogram

../../../img/srcFileCovDistChart8.png
21% 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 12 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  45 toggle public Skip2(String s, boolean ign, int offset)
22    {
23  45 super(s, ign, offset);
24  45 c1 = s.charAt(1);
25  45 m1 = 2 == s.length();
26  45 if (ign)
27    {
28  0 mask1 = mkmask(c1);
29    }
30    else
31    {
32  45 mask1 = 0;
33    }
34    }
35   
 
36  127535 toggle public int find(StringLike s, int start, int end)
37    {
38  127535 if (start > end)
39    {
40  0 return -1;
41    }
42  127535 start += offset;
43  127535 int vend = min(s.length() - 2, end + offset);
44  127535 for (int i = start; i <= vend; i++)
45    {
46  126618 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  126618 if (m1 || CaseMgr.regionMatches(s, ign, i, src, 0, src.length()))
50    {
51  126618 return i - offset;
52    }
53    }
54    }
55  917 return -1;
56    }
57    }