Clover icon

Coverage Report

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

File BackRefRule.java

 

Coverage histogram

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

Code metrics

2
5
4
1
40
22
5
1
1.25
4
1.25

Classes

Class Line # Actions
BackRefRule 16 5 5
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    /**
11    * This method implements the pattern elements $1, $2, etc in a substitution
12    * rule. The apply(StringBufferLike sb,RegRes rr) method of this ReplaceRule
13    * simply appends the contents of rr.stringMatched(n), where n is the integer
14    * supplied to the constructor.
15    */
 
16    public class BackRefRule extends ReplaceRule
17    {
18    int n;
19   
 
20  0 toggle public BackRefRule(int n)
21    {
22  0 this.n = n;
23    }
24   
 
25  0 toggle public void apply(StringBufferLike sb, RegRes res)
26    {
27  0 String x = res.stringMatched(n);
28  0 sb.append(x == null ? "" : x);
29    }
30   
 
31  0 toggle public String toString1()
32    {
33  0 return "$" + n;
34    }
35   
 
36  0 toggle public Object clone1()
37    {
38  0 return new BackRefRule(n);
39    }
40    }