Clover icon

Coverage Report

  1. Project Clover database Wed Nov 13 2024 16:21:17 GMT
  2. Package com.stevesoft.pat

File lookAhead.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.png
59% of files have more coverage

Code metrics

12
24
8
1
99
81
14
0.58
3
8
1.75

Classes

Class Line # Actions
lookAhead 13 24 14
0.00%
 

Contributing tests

No tests hitting this source file were found.

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    /** Implements "(?= )" and "(?! )" */
 
13    class lookAhead extends Or
14    {
15    boolean reverse;
16   
 
17  0 toggle lookAhead(boolean b)
18    {
19  0 reverse = b;
20    }
21   
 
22  0 toggle public Pattern getNext()
23    {
24  0 return null;
25    }
26   
 
27  0 toggle public int nextMatch(int pos, Pthings pt)
28    {
29  0 Pattern p = super.getNext();
30  0 if (p != null)
31    {
32  0 return p.matchInternal(pos, pt);
33    }
34    else
35    {
36  0 return pos;
37    }
38    }
39   
 
40  0 toggle public int matchInternal(int pos, Pthings pt)
41    {
42  0 if (super.matchInternal(pos, pt) >= 0)
43    {
44  0 if (reverse)
45    {
46  0 return -1;
47    }
48    else
49    {
50  0 return nextMatch(pos, pt);
51    }
52    }
53    else
54    {
55  0 if (reverse)
56    {
57  0 return nextMatch(pos, pt);
58    }
59    else
60    {
61  0 return -1;
62    }
63    }
64    }
65   
 
66  0 toggle String leftForm()
67    {
68  0 if (reverse)
69    {
70  0 return "(?!";
71    }
72    else
73    {
74  0 return "(?=";
75    }
76    }
77   
 
78  0 toggle public patInt minChars()
79    {
80  0 return new patInt(0);
81    }
82   
 
83  0 toggle public patInt maxChars()
84    {
85  0 return new patInt(0);
86    }
87   
 
88  0 toggle Pattern clone1(Hashtable h)
89    {
90  0 lookAhead la = new lookAhead(reverse);
91  0 h.put(this, la);
92  0 h.put(la, la);
93  0 for (int i = 0; i < v.size(); i++)
94    {
95  0 la.v.addElement(((Pattern) v.elementAt(i)).clone(h));
96    }
97  0 return la;
98    }
99    }