mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
Replace java.util.regex.* with the new regular expression engine
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
48
classpath/java/util/regex/TrivialMatcher.java
Normal file
48
classpath/java/util/regex/TrivialMatcher.java
Normal file
@ -0,0 +1,48 @@
|
||||
/* Copyright (c) 2008-2013, 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 is a work in progress.
|
||||
*
|
||||
* @author zsombor and others
|
||||
*/
|
||||
class TrivialMatcher extends Matcher {
|
||||
private final String pattern;
|
||||
|
||||
TrivialMatcher(String pattern, CharSequence input) {
|
||||
super(input);
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public boolean matches() {
|
||||
if (pattern.equals(input.toString())) {
|
||||
start = 0;
|
||||
end = input.length();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean find(int start) {
|
||||
String p = pattern;
|
||||
int i = TrivialPattern.indexOf(input, p, start);
|
||||
if (i >= 0) {
|
||||
this.start = i;
|
||||
this.end = i + p.length();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user