From 4fed24270b3ffe54278d07ac53968fbb5566bacd Mon Sep 17 00:00:00 2001 From: Zsombor Date: Sun, 13 Jul 2008 20:33:51 -0600 Subject: [PATCH] add skeleton java.util.regex classes --- classpath/java/util/regex/Matcher.java | 106 +++++++++++++++++++++++++ classpath/java/util/regex/Pattern.java | 75 +++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 classpath/java/util/regex/Matcher.java create mode 100644 classpath/java/util/regex/Pattern.java diff --git a/classpath/java/util/regex/Matcher.java b/classpath/java/util/regex/Matcher.java new file mode 100644 index 0000000000..58af1a707d --- /dev/null +++ b/classpath/java/util/regex/Matcher.java @@ -0,0 +1,106 @@ +/* Copyright (c) 2008, Avian Contributors + + Permission to use, copy, modify, and/or distribute this software + for any purpose with or without fee is hereby granted, provided + that the above copyright notice and this permission notice appear + in all copies. + + There is NO WARRANTY for this software. See license.txt for + details. */ + +package java.util.regex; + +/** + * This implementation is a skeleton, useful only for compilation. At runtime it + * is need to be replaced by a working implementation, for example one from the + * Apache Harmony project. + * + * @author zsombor + * + */ +public class Matcher { + + public boolean matches() { + throw new UnsupportedOperationException(); + } + + public boolean requireEnd() { + throw new UnsupportedOperationException(); + } + + public boolean hitEnd() { + throw new UnsupportedOperationException(); + } + + public boolean lookingAt() { + throw new UnsupportedOperationException(); + } + + public Matcher reset() { + throw new UnsupportedOperationException(); + } + + public Matcher reset(CharSequence input) { + throw new UnsupportedOperationException(); + } + + public int start() { + throw new UnsupportedOperationException(); + } + + public int start(int group) { + throw new UnsupportedOperationException(); + } + + public Pattern pattern() { + throw new UnsupportedOperationException(); + } + + public Matcher region(int start, int end) { + throw new UnsupportedOperationException(); + } + + public int regionEnd() { + throw new UnsupportedOperationException(); + } + + public int regionStart() { + throw new UnsupportedOperationException(); + } + + public String replaceAll(String replacement) { + throw new UnsupportedOperationException(); + } + + public String replaceFirst(String replacement) { + throw new UnsupportedOperationException(); + } + + public int end() { + throw new UnsupportedOperationException(); + } + + public int end(int group) { + throw new UnsupportedOperationException(); + } + + public boolean find() { + throw new UnsupportedOperationException(); + } + + public boolean find(int start) { + throw new UnsupportedOperationException(); + } + + public int groupCount() { + throw new UnsupportedOperationException(); + } + + public String group() { + throw new UnsupportedOperationException(); + } + + public String group(int group) { + throw new UnsupportedOperationException(); + } +} diff --git a/classpath/java/util/regex/Pattern.java b/classpath/java/util/regex/Pattern.java new file mode 100644 index 0000000000..972f93de37 --- /dev/null +++ b/classpath/java/util/regex/Pattern.java @@ -0,0 +1,75 @@ +/* Copyright (c) 2008, Avian Contributors + + Permission to use, copy, modify, and/or distribute this software + for any purpose with or without fee is hereby granted, provided + that the above copyright notice and this permission notice appear + in all copies. + + There is NO WARRANTY for this software. See license.txt for + details. */ + +package java.util.regex; + +/** + * This implementation is a skeleton, useful only for compilation. At runtime it + * is need to be replaced by a working implementation, for example one from the + * Apache Harmony project. + * + * @author zsombor + * + */ +public class Pattern { + + public static final int UNIX_LINES = 1; + public static final int CASE_INSENSITIVE = 2; + public static final int COMMENTS = 4; + public static final int MULTILINE = 8; + public static final int LITERAL = 16; + public static final int DOTALL = 32; + public static final int UNICODE_CASE = 64; + public static final int CANON_EQ = 128; + + private int patternFlags; + private String pattern; + + protected Pattern(String pattern, int flags) { + this.pattern = pattern; + this.patternFlags = flags; + } + + public static Pattern compile(String regex) { + return new Pattern(regex, 0); + } + + public static Pattern compile(String regex, int flags) { + return new Pattern(regex, flags); + } + + public int flags() { + return patternFlags; + } + + public Matcher matcher(CharSequence input) { + throw new UnsupportedOperationException(); + } + + public static boolean matches(String regex, CharSequence input) { + return Pattern.compile(regex).matcher(input).matches(); + } + + public String pattern() { + return pattern; + } + + public static String quote(String s) { + throw new UnsupportedOperationException(); + } + + public String[] split(CharSequence input) { + throw new UnsupportedOperationException(); + } + + public String[] split(CharSequence input, int limit) { + throw new UnsupportedOperationException(); + } +}