Clover icon

Coverage Report

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

File oneChar.java

 

Coverage histogram

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

Code metrics

6
23
6
1
76
59
14
0.61
3.83
6
2.33

Classes

Class Line # Actions
oneChar 13 23 14
0.880%
 

Contributing tests

This file is covered by 101 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 matches a single character. */
 
13    class oneChar extends Pattern
14    {
15    char c, altc, altc2;
16   
17    int mask;
18   
 
19  33221 toggle public oneChar(char ci)
20    {
21  33221 c = ci;
22  33221 char cu, cl, ct;
23  33221 cu = CaseMgr.toUpperCase(c);
24  33221 cl = CaseMgr.toLowerCase(c);
25  33221 ct = CaseMgr.toTitleCase(c);
26  33221 if (c == cu)
27    {
28  29683 altc = cl;
29  29683 altc2 = ct;
30    }
31  3538 else if (c == cl)
32    {
33  3538 altc = cu;
34  3538 altc2 = ct;
35    }
36    else
37    {
38  0 altc = cl;
39  0 altc2 = cu;
40    }
41  33221 mask = c & altc & altc2;
42    }
43   
 
44  289424 toggle public int matchInternal(int pos, Pthings pt)
45    {
46  289424 char p;
47  289424 int ret = -1;
48  ? if (pos < pt.src.length() && !Masked(pos, pt)
49    && ((p = pt.src.charAt(pos)) == c
50    || (pt.ignoreCase && (p == altc || p == altc2))))
51    {
52  3590 ret = nextMatch(pos + 1, pt);
53    }
54  289424 return ret;
55    }
56   
 
57  0 toggle public String toString()
58    {
59  0 return protect("" + c, PROTECT_THESE, ESC) + nextString();
60    }
61   
 
62  143 toggle public patInt minChars()
63    {
64  143 return new patInt(1);
65    }
66   
 
67  72 toggle public patInt maxChars()
68    {
69  72 return new patInt(1);
70    }
71   
 
72  1568 toggle Pattern clone1(Hashtable h)
73    {
74  1568 return new oneChar(c);
75    }
76    };