[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Patch: FYI: java.util.regex.MatchResult
From: |
Tom Tromey |
Subject: |
[cp-patches] Patch: FYI: java.util.regex.MatchResult |
Date: |
23 Jan 2006 14:44:46 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
I'm checking this in.
This adds the new java.util.regex.MatchResult interface.
Tom
2006-01-23 Tom Tromey <address@hidden>
* java/util/regex/PatternSyntaxException.java: Added @since.
* java/util/regex/Matcher.java (Matcher): Implements MatchResult.
* java/util/regex/MatchResult.java: New file.
Index: java/util/regex/Matcher.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/regex/Matcher.java,v
retrieving revision 1.10
diff -u -r1.10 Matcher.java
--- java/util/regex/Matcher.java 13 Sep 2005 22:19:15 -0000 1.10
+++ java/util/regex/Matcher.java 23 Jan 2006 21:37:35 -0000
@@ -45,7 +45,7 @@
*
* @since 1.4
*/
-public final class Matcher
+public final class Matcher implements MatchResult
{
private Pattern pattern;
private CharSequence input;
Index: java/util/regex/PatternSyntaxException.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/java/util/regex/PatternSyntaxException.java,v
retrieving revision 1.4
diff -u -r1.4 PatternSyntaxException.java
--- java/util/regex/PatternSyntaxException.java 2 Jul 2005 20:32:44 -0000
1.4
+++ java/util/regex/PatternSyntaxException.java 23 Jan 2006 21:37:35 -0000
@@ -41,6 +41,7 @@
* Indicates illegal pattern for regular expression.
* Includes state to inspect the pattern and what and where the expression
* was not valid regular expression.
+ * @since 1.4
*/
public class PatternSyntaxException extends IllegalArgumentException
{
Index: java/util/regex/MatchResult.java
===================================================================
RCS file: java/util/regex/MatchResult.java
diff -N java/util/regex/MatchResult.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ java/util/regex/MatchResult.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,81 @@
+/* MatchResult.java -- Result of a regular expression match.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.regex;
+
+/**
+ * This interface represents the result of a regular expression match.
+ * It can be used to query the contents of the match, but not to modify
+ * them.
+ * @since 1.5
+ */
+public interface MatchResult
+{
+ /** Returns the index just after the last matched character. */
+ int end();
+
+ /**
+ * Returns the index just after the last matched character of the
+ * given sub-match group.
+ * @param group the sub-match group
+ */
+ int end(int group);
+
+ /** Returns the substring of the input which was matched. */
+ String group();
+
+ /**
+ * Returns the substring of the input which was matched by the
+ * given sub-match group.
+ * @param group the sub-match group
+ */
+ String group(int group);
+
+ /** Returns the number of sub-match groups in the matching pattern. */
+ int groupCount();
+
+ /** Returns the index of the first character of the match. */
+ int start();
+
+ /**
+ * Returns the index of the first character of the given sub-match
+ * group.
+ * @param group the sub-match group
+ */
+ int start(int group);
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] Patch: FYI: java.util.regex.MatchResult,
Tom Tromey <=