aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/regex
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2012-12-19 17:03:15 +0000
committerMatthias Klose <doko@gcc.gnu.org>2012-12-19 17:03:15 +0000
commita1906e8bbfa426ed1adfe751608bc74f1d4d2ab7 (patch)
tree9b478aacc6b13f1beadacec2ade096dcb732af53 /libjava/classpath/java/util/regex
parentbaeb2e16475b278e83fe73751d4f0f572805b16e (diff)
downloadgcc-a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7.zip
gcc-a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7.tar.gz
gcc-a1906e8bbfa426ed1adfe751608bc74f1d4d2ab7.tar.bz2
Import GNU Classpath (20121202).
2012-12-19 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (20121202). * Regenerate class and header files. * Regenerate auto* files. * sources.am, gcj/javaprims.h: Regenerate. * gnu/java/nio/FileLockImpl.java (close): New override. From-SVN: r194618
Diffstat (limited to 'libjava/classpath/java/util/regex')
-rw-r--r--libjava/classpath/java/util/regex/Matcher.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/libjava/classpath/java/util/regex/Matcher.java b/libjava/classpath/java/util/regex/Matcher.java
index 8d033d5..95a3553 100644
--- a/libjava/classpath/java/util/regex/Matcher.java
+++ b/libjava/classpath/java/util/regex/Matcher.java
@@ -103,6 +103,28 @@ public final class Matcher implements MatchResult
}
/**
+ * Changes the pattern used by the {@link Matcher} to
+ * the one specified. Existing match information is lost,
+ * but the input and the matcher's position within it is
+ * retained.
+ *
+ * @param newPattern the new pattern to use.
+ * @return this matcher.
+ * @throws IllegalArgumentException if {@code newPattern} is
+ * {@code null}.
+ * @since 1.5
+ */
+ public Matcher usePattern(Pattern newPattern)
+ {
+ if (newPattern == null)
+ throw new IllegalArgumentException("The new pattern was null.");
+ pattern = newPattern;
+ match = null;
+
+ return this;
+ }
+
+ /**
* @param sb The target string buffer
* @param replacement The replacement string
*
@@ -620,7 +642,7 @@ public final class Matcher implements MatchResult
*
* @param s the string to literalize.
* @return the literalized string.
- * @since 1.5
+ * @since 1.5
*/
public static String quoteReplacement(String s)
{