From 6fec1adc6432eeafcdea2ab165989e170cb6e64e Mon Sep 17 00:00:00 2001 From: doko Date: Wed, 19 Dec 2012 17:03:15 +0000 Subject: 2012-12-19 Matthias Klose 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194618 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/java/util/regex/Matcher.java | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libjava/classpath/java/util/regex') diff --git a/libjava/classpath/java/util/regex/Matcher.java b/libjava/classpath/java/util/regex/Matcher.java index 8d033d5e316..95a35535935 100644 --- a/libjava/classpath/java/util/regex/Matcher.java +++ b/libjava/classpath/java/util/regex/Matcher.java @@ -102,6 +102,28 @@ public final class Matcher implements MatchResult anchoringBounds = 0; } + /** + * 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) { -- cgit v1.2.3