Clover icon

Coverage Report

  1. Project Clover database Mon Nov 18 2024 09:38:20 GMT
  2. Package com.stevesoft.pat

File oneChar.java

 

Coverage histogram

../../../img/srcFileCovDistChart8.png
13% 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 57 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  18913 toggle public oneChar(char ci)
20    {
21  18913 c = ci;
22  18913 char cu, cl, ct;
23  18913 cu = CaseMgr.toUpperCase(c);
24  18913 cl = CaseMgr.toLowerCase(c);
25  18913 ct = CaseMgr.toTitleCase(c);
26  18913 if (c == cu)
27    {
28  16745 altc = cl;
29  16745 altc2 = ct;
30    }
31  2168 else if (c == cl)
32    {
33  2168 altc = cu;
34  2168 altc2 = ct;
35    }
36    else
37    {
38  0 altc = cl;
39  0 altc2 = cu;
40    }
41  18913 mask = c & altc & altc2;
42    }
43   
 
44  192190 toggle public int matchInternal(int pos, Pthings pt)
45    {
46  192190 char p;
47  192190 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  1956 ret = nextMatch(pos + 1, pt);
53    }
54  192190 return ret;
55    }
56   
 
57  0 toggle public String toString()
58    {
59  0 return protect("" + c, PROTECT_THESE, ESC) + nextString();
60    }
61   
 
62  7 toggle public patInt minChars()
63    {
64  7 return new patInt(1);
65    }
66   
 
67  2 toggle public patInt maxChars()
68    {
69  2 return new patInt(1);
70    }
71   
 
72  1072 toggle Pattern clone1(Hashtable h)
73    {
74  1072 return new oneChar(c);
75    }
76    };