Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/acmsl/regexpplugin/MatchResult.java


1   /*
2                   Java Regular Expressions Plugin API
3   
4       Copyright (C) 2002  Jose San Leandro Armendáriz
5                           jsanleandro@yahoo.es
6                           chousz@yahoo.com
7   
8       This library is free software; you can redistribute it and/or
9       modify it under the terms of the GNU Lesser General Public
10      License as published by the Free Software Foundation; either
11      version 2.1 of the License, or (at your option) any later version.
12  
13      This library is distributed in the hope that it will be useful,
14      but WITHOUT ANY WARRANTY; without even the implied warranty of
15      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16      Lesser General Public License for more details.
17  
18      You should have received a copy of the GNU Lesser General Public
19      License along with this library; if not, write to the Free Software
20      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  
22      Thanks to ACM S.L. for distributing this library under the LGPL license.
23      Contact info: jsr000@terra.es
24      Postal Address: c/Playa de Lagoa, 1
25                      Urb. Valdecabañas
26                      Boadilla del monte
27                      28660 Madrid
28                      Spain
29  
30      This library uses some external APIs. So far I haven't released such
31      APIs as projects themselves, but you should be able
32      to download them from the web page where you got this source code.
33  
34   ******************************************************************************
35   *
36   * Filename: $RCSfile: MatchResult.java,v $
37   *
38   * Author: Jose San Leandro Armendáriz
39   *
40   * Description: Represents the result of match in a regexp parsing process.
41   *              Different implementations vary but they all must respect this
42   *              set of methods.
43   *
44   * Last modified by: $Author: dev $ at $Date: 2002/09/27 08:27:11 $
45   *
46   * File version: $Revision: 1.5 $
47   *
48   * Project version: $Name:  $
49   *                  ("Name" means no concrete version has been checked out)
50   *
51   * $Id: MatchResult.java,v 1.5 2002/09/27 08:27:11 dev Exp $
52   *
53   */
54  package org.acmsl.regexpplugin;
55  
56  /*
57   * Importing some ACM classes.
58   */
59  import org.acmsl.version.Version;
60  import org.acmsl.version.Versionable;
61  import org.acmsl.version.VersionFactory;
62  
63  /**
64   * Represents the result of match in a regexp parsing process. Different
65   * implementations vary but they all must respect this set of methods.
66   * @author <a href="mailto:jsanleandro@yahoo.es"
67             >Jose San Leandro Armendáriz</a>
68   * @version $Revision: 1.5 $
69   */
70  public interface MatchResult
71      extends  Versionable
72  {
73      /**
74       * Taken from Jakarta ORO javadoc:
75       * <i>Returns the contents of the parenthesized subgroups of a match,
76       * counting parentheses from left to right and starting from 1. Group 0
77       * always refers to the entire match. <br/>
78       * For example, if the pattern foo(\d+)
79       * is used to extract a match from the input abfoo123 , then group(0) will
80       * return foo123 and group(1) will return 123 . group(2) will return null
81       * because there is only one subgroup in the original pattern.</i>
82       * @param group The pattern subgroup to return.
83       * @return A string containing the indicated pattern subgroup. Group 0
84       * always refers to the entire match. If a group was never matched, it
85       * returns null. This is not to be confused with a group matching the null
86       * string, which will return a String of length 0.
87       */
88      public String group(int group);
89  
90      /**
91       * Taken from Jakarta ORO 2.0.6 javadoc:
92       * <i>The number of groups contained in the result. This number
93       * includes the 0th group. In other words, the result refers to
94       * the number of parenthesized subgroups plus the entire match
95       * itself.</i>.
96       * @return such value.
97       */
98      public int groups();
99  
100     /**
101      * Concrete version object updated everytime it's checked-in in a CVS
102      * repository.
103      */
104     public static final Version VERSION =
105         VersionFactory.createVersion("$Revision: 1.5 $");
106 }