Clover icon

Coverage Report

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

File Start.java

 

Coverage histogram

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

Code metrics

6
11
5
1
56
41
11
1
2.2
5
2.2

Classes

Class Line # Actions
Start 13 11 11
0.5454545654.5%
 

Contributing tests

This file is covered by 15 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    /** The '^' or the '\A' Pattern, matches the start of a string. */
 
13    class Start extends Pattern
14    {
15    boolean retIsStart;
16   
 
17  65 toggle Start(boolean b)
18    {
19  65 retIsStart = b;
20    }
21   
 
22  231626 toggle public int matchInternal(int pos, Pthings pt)
23    {
24  231626 if (retIsStart && pt.mFlag && pos > 0 && pt.src.charAt(pos - 1) == '\n')
25    {
26  0 return nextMatch(pos, pt);
27    }
28  231626 if (pos == 0)
29    {
30  2841 return nextMatch(pos, pt);
31    }
32  228785 return -1;
33    }
34   
 
35  0 toggle public String toString()
36    {
37  0 if (retIsStart)
38    {
39  0 return "^" + nextString();
40    }
41    else
42    {
43  0 return "\\A" + nextString();
44    }
45    }
46   
 
47  45 toggle public patInt maxChars()
48    {
49  45 return new patInt(0);
50    }
51   
 
52  0 toggle Pattern clone1(Hashtable h)
53    {
54  0 return new Start(retIsStart);
55    }
56    };