40 |
|
|
41 |
import java.io.Serializable; |
import java.io.Serializable; |
42 |
|
|
43 |
|
/** |
44 |
|
* @author Michael Koch |
45 |
|
* @since 1.4 |
46 |
|
*/ |
47 |
public class Pattern implements Serializable |
public class Pattern implements Serializable |
48 |
{ |
{ |
49 |
public static Pattern compile(String regex) |
private static final long serialVersionUID = 5073258162644648461L; |
50 |
|
|
51 |
|
public static final int CANON_EQ = 128; |
52 |
|
public static final int CASE_INSENSITIVE = 2; |
53 |
|
public static final int COMMENTS = 4; |
54 |
|
public static final int DOTALL = 32; |
55 |
|
public static final int MULTILINE = 8; |
56 |
|
public static final int UNICODE_CASE = 64; |
57 |
|
public static final int UNIX_LINES = 1; |
58 |
|
|
59 |
|
private String regex; |
60 |
|
private int flags; |
61 |
|
|
62 |
|
private Pattern (String regex) |
63 |
|
throws PatternSyntaxException |
64 |
|
{ |
65 |
|
this (regex, 0); |
66 |
|
} |
67 |
|
|
68 |
|
private Pattern (String regex, int flags) |
69 |
|
throws PatternSyntaxException |
70 |
|
{ |
71 |
|
this.regex = regex; |
72 |
|
this.flags = flags; |
73 |
|
|
74 |
|
throw new Error ("Not implemented"); |
75 |
|
} |
76 |
|
|
77 |
|
/** |
78 |
|
* @param regex The regular expression |
79 |
|
* |
80 |
|
* @exception PatternSyntaxException If the expression's syntax is invalid |
81 |
|
*/ |
82 |
|
public static Pattern compile (String regex) |
83 |
|
throws PatternSyntaxException |
84 |
|
{ |
85 |
|
throw new Error ("Not implemented"); |
86 |
|
} |
87 |
|
|
88 |
|
/** |
89 |
|
* @param regex The regular expression |
90 |
|
* @param flags The match flags, a bit mask |
91 |
|
* |
92 |
|
* @exception PatternSyntaxException If the expression's syntax is invalid |
93 |
|
* @exception IllegalArgumentException If bit values other than those |
94 |
|
* corresponding to the defined match flags are set in flags |
95 |
|
*/ |
96 |
|
public static Pattern compile (String regex, int flags) |
97 |
|
throws PatternSyntaxException |
98 |
|
{ |
99 |
|
// FIXME: check which flags are really accepted |
100 |
|
if ((flags & ~0xEF) != 0) |
101 |
|
throw new IllegalArgumentException (); |
102 |
|
|
103 |
|
return new Pattern (regex, flags); |
104 |
|
} |
105 |
|
|
106 |
|
public int flags () |
107 |
|
{ |
108 |
|
return this.flags; |
109 |
|
} |
110 |
|
|
111 |
|
/** |
112 |
|
* @param regex The regular expression |
113 |
|
* @param input The character sequence to be matched |
114 |
|
* |
115 |
|
* @exception PatternSyntaxException If the expression's syntax is invalid |
116 |
|
*/ |
117 |
|
public static boolean matches (String regex, CharSequence input) |
118 |
|
{ |
119 |
|
throw new Error ("Not implemented"); |
120 |
|
} |
121 |
|
|
122 |
|
/** |
123 |
|
* @param input The character sequence to be matched |
124 |
|
*/ |
125 |
|
public Matcher matcher (CharSequence input) |
126 |
{ |
{ |
127 |
throw new InternalError("Not implemented yet"); |
throw new Error ("Not implemented"); |
128 |
} |
} |
129 |
public static boolean matches(String regex, CharSequence input) |
|
130 |
|
/** |
131 |
|
* @param input The character sequence to be matched |
132 |
|
*/ |
133 |
|
public String[] split (CharSequence input) |
134 |
{ |
{ |
135 |
throw new InternalError("Not implemented yet"); |
throw new Error ("Not implemented"); |
136 |
} |
} |
137 |
public Matcher matcher(CharSequence input) |
|
138 |
|
/** |
139 |
|
* @param input The character sequence to be matched |
140 |
|
* @param limit The result threshold |
141 |
|
*/ |
142 |
|
public String[] split (CharSequence input, int limit) |
143 |
{ |
{ |
144 |
throw new InternalError("Not implemented yet"); |
throw new Error ("Not implemented"); |
145 |
} |
} |
146 |
public String[] split(CharSequence input, int limit) |
|
147 |
|
public String pattern () |
148 |
{ |
{ |
149 |
throw new InternalError("Not implemented yet"); |
throw new Error ("Not implemented"); |
150 |
} |
} |
151 |
} |
} |