JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / unused / com / stevesoft / pat / TransPat.java
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 class is used to implement the Transformer
12  * 
13  * @see com.stevesoft.pat.Transform
14  */
15 class TransPat extends Pattern
16 {
17   Regex[] ra = new Regex[10];
18
19   int ra_len = 0;
20
21   int pn = -1;
22
23   public String toString()
24   {
25     return "(?#TransPat)";
26   }
27
28   TransPat()
29   {
30         
31   }
32
33   int lastMatchedTo = -1;
34
35   public int matchInternal(int pos, Pthings pt)
36   {
37     for (int i = 0; i < ra_len; i++)
38     {
39       pt.ignoreCase = ra[i].ignoreCase;
40       pt.mFlag = ra[i].mFlag;
41       pt.dotDoesntMatchCR = Regex.dotDoesntMatchCR;
42       int r = ra[i].thePattern.matchInternal(pos, pt);
43       if (r >= 0)
44       {
45         pn = i;
46         return r;
47       }
48     }
49     pn = -1;
50     return -1;
51   }
52 }