Class | Line # | Actions | |||
---|---|---|---|---|---|
Any | 15 | 10 | 8 |
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 | /** | |
13 | * This is the '.' character in a Pattern. It matches any character. | |
14 | */ | |
15 | class Any extends Pattern | |
16 | { | |
17 | 13 | public int matchInternal(int pos, Pthings pt) |
18 | { | |
19 | 13 | if (pos < pt.src.length()) |
20 | { | |
21 | 13 | if (pt.dotDoesntMatchCR) |
22 | { | |
23 | 13 | if (pt.src.charAt(pos) != '\n') |
24 | { | |
25 | 13 | return nextMatch(pos + 1, pt); |
26 | } | |
27 | } | |
28 | else | |
29 | { | |
30 | 0 | return nextMatch(pos + 1, pt); |
31 | } | |
32 | } | |
33 | 0 | return -1; |
34 | } | |
35 | ||
36 | 0 | public String toString() |
37 | { | |
38 | 0 | return "." + nextString(); |
39 | } | |
40 | ||
41 | 0 | public patInt minChars() |
42 | { | |
43 | 0 | return new patInt(1); |
44 | } | |
45 | ||
46 | 0 | public patInt maxChars() |
47 | { | |
48 | 0 | return new patInt(1); |
49 | } | |
50 | ||
51 | 0 | public Pattern clone1(Hashtable h) |
52 | { | |
53 | 0 | return new Any(); |
54 | } | |
55 | }; |