Clover icon

Coverage Report

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

File Start.java

 

Coverage histogram

../../../img/srcFileCovDistChart6.png
33% 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 13 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  54 toggle Start(boolean b)
18    {
19  54 retIsStart = b;
20    }
21   
 
22  235105 toggle public int matchInternal(int pos, Pthings pt)
23    {
24  235105 if (retIsStart && pt.mFlag && pos > 0 && pt.src.charAt(pos - 1) == '\n')
25    {
26  0 return nextMatch(pos, pt);
27    }
28  235105 if (pos == 0)
29    {
30  2797 return nextMatch(pos, pt);
31    }
32  232308 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  42 toggle public patInt maxChars()
48    {
49  42 return new patInt(0);
50    }
51   
 
52  0 toggle Pattern clone1(Hashtable h)
53    {
54  0 return new Start(retIsStart);
55    }
56    };