Clover icon

Coverage Report

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

File Boundary.java

 

Coverage histogram

../../../img/srcFileCovDistChart6.png
33% of files have more coverage

Code metrics

20
27
7
1
89
73
23
0.85
3.86
7
3.29

Classes

Class Line # Actions
Boundary 13 27 23
0.518518551.9%
 

Contributing tests

This file is covered by 9 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    import java.util.Hashtable;
11   
12    /** This class implements the word boundary pattern element: \b. */
 
13    class Boundary extends Pattern
14    {
 
15  0 toggle public String toString()
16    {
17  0 return "\\b" + nextString();
18    }
19   
 
20  103 toggle boolean isAChar(char c)
21    {
22  103 if (c >= 'a' && c <= 'z')
23    {
24  0 return true;
25    }
26  103 if (c >= 'A' && c <= 'Z')
27    {
28  0 return true;
29    }
30  103 if (c >= '0' && c <= '9')
31    {
32  0 return true;
33    }
34  103 if (c == '_')
35    {
36  0 return true;
37    }
38  103 return false;
39    }
40   
 
41  243 toggle boolean matchLeft(int pos, Pthings pt)
42    {
43  243 if (pos <= 0)
44    {
45  243 return true;
46    }
47  0 if (isAChar(pt.src.charAt(pos)) && isAChar(pt.src.charAt(pos - 1)))
48    {
49  0 return false;
50    }
51  0 return true;
52    }
53   
 
54  346 toggle boolean matchRight(int pos, Pthings pt)
55    {
56  346 if (pos < 0)
57    {
58  243 return false;
59    }
60  103 if (pos + 1 >= pt.src.length())
61    {
62  0 return true;
63    }
64  103 if (isAChar(pt.src.charAt(pos)) && isAChar(pt.src.charAt(pos + 1)))
65    {
66  0 return false;
67    }
68  103 return true;
69    }
70   
 
71  346 toggle public int matchInternal(int pos, Pthings pt)
72    {
73  346 if (matchRight(pos - 1, pt) || matchLeft(pos, pt))
74    {
75  346 return nextMatch(pos, pt);
76    }
77  0 return -1;
78    }
79   
 
80  0 toggle public patInt maxChars()
81    {
82  0 return new patInt(0);
83    }
84   
 
85  0 toggle public Pattern clone1(Hashtable h)
86    {
87  0 return new Boundary();
88    }
89    };