source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/util/regexp/RegexpMatcher.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 3.3 KB
Line 
1/*
2 * Copyright 2000-2002,2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18package org.apache.tools.ant.util.regexp;
19
20import java.util.Vector;
21import org.apache.tools.ant.BuildException;
22
23/**
24 * Interface describing a regular expression matcher.
25 *
26 */
27public interface RegexpMatcher {
28
29 /***
30 * Default Mask (case insensitive, neither multiline nor
31 * singleline specified).
32 */
33 int MATCH_DEFAULT = 0x00000000;
34
35 /***
36 * Perform a case insenstive match
37 */
38 int MATCH_CASE_INSENSITIVE = 0x00000100;
39
40 /***
41 * Treat the input as a multiline input
42 */
43 int MATCH_MULTILINE = 0x00001000;
44
45 /***
46 * Treat the input as singleline input ('.' matches newline)
47 */
48 int MATCH_SINGLELINE = 0x00010000;
49
50
51 /**
52 * Set the regexp pattern from the String description.
53 * @param pattern the pattern to match
54 * @throws BuildException on error
55 */
56 void setPattern(String pattern) throws BuildException;
57
58 /**
59 * Get a String representation of the regexp pattern
60 * @return the pattern
61 * @throws BuildException on error
62 */
63 String getPattern() throws BuildException;
64
65 /**
66 * Does the given argument match the pattern?
67 * @param argument the string to match against
68 * @return true if the pattern matches
69 * @throws BuildException on error
70 */
71 boolean matches(String argument) throws BuildException;
72
73 /**
74 * Returns a Vector of matched groups found in the argument
75 * using default options.
76 *
77 * <p>Group 0 will be the full match, the rest are the
78 * parenthesized subexpressions</p>.
79 *
80 * @param argument the string to match against
81 * @return the vector of groups
82 * @throws BuildException on error
83 */
84 Vector getGroups(String argument) throws BuildException;
85
86 /***
87 * Does this regular expression match the input, given
88 * certain options
89 * @param input The string to check for a match
90 * @param options The list of options for the match. See the
91 * MATCH_ constants above.
92 * @return true if the pattern matches
93 * @throws BuildException on error
94 */
95 boolean matches(String input, int options) throws BuildException;
96
97 /***
98 * Get the match groups from this regular expression. The return
99 * type of the elements is always String.
100 * @param input The string to check for a match
101 * @param options The list of options for the match. See the
102 * MATCH_ constants above.
103 * @return the vector of groups
104 * @throws BuildException on error
105 */
106 Vector getGroups(String input, int options) throws BuildException;
107
108}
Note: See TracBrowser for help on using the repository browser.