01: /*
02: * This file is part of "SnipSnap Radeox Rendering Engine".
03: *
04: * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
05: * All Rights Reserved.
06: *
07: * Please visit http://radeox.org/ for updates and contact.
08: *
09: * --LICENSE NOTICE--
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: * --LICENSE NOTICE--
22: */
23:
24: package org.radeox.regex;
25:
26: /*
27: * The result when a Matcher object finds matches in some input @author stephan
28: * @team sonicteam
29: *
30: * @version $Id: MatchResult.java 7756 2006-04-13 12:25:49Z ian@caret.cam.ac.uk $
31: */
32:
33: public abstract class MatchResult {
34:
35: /**
36: * Create a new MatchResult depending on the used implementation
37: *
38: * @param matcher
39: * Matcher object of the implementation
40: * @return MatchResult for the Matcher
41: */
42: public static MatchResult create(Matcher matcher) {
43: return new JdkMatchResult(matcher);
44: }
45:
46: /**
47: * Returns the number of groups (...) found
48: *
49: * @return Number of found groups
50: */
51: public abstract int groups();
52:
53: /**
54: * Return the content of group with the index i
55: *
56: * @param i
57: * index for the group
58: * @return Content of the group with the index i
59: */
60: public abstract String group(int i);
61:
62: /**
63: * The offset of the beginning of the match for the group with the index i
64: *
65: * @param i
66: * index for the group
67: * @return Offset of the group
68: */
69: public abstract int beginOffset(int i);
70:
71: /**
72: * The offset of the end of the match for the group with the index i
73: *
74: * @param i
75: * index for the group
76: * @return Offset of the group
77: */
78: public abstract int endOffset(int i);
79: }
|