public class SimpleResult extends Object implements Result
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleResult(boolean succeeded,
String input,
String before,
String group,
boolean canStopMatching)
Creates an instance with the initial field values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canStopMatching()
Indicates that the matching operation won't have a different result at any point
in the future and there is no need to wait for the successful match.
|
int |
end() |
int |
end(int group) |
static Result |
failure(String input,
boolean canStopMatching)
Creates an instance of an unsuccessful match.
|
String |
getBefore()
Returns a part of the input string from the beginning until the starting position of the
match.
|
String |
getInput()
Gets latest input string passed to the matcher before it returns.
|
String |
group() |
String |
group(int group) |
int |
groupCount() |
boolean |
isSuccessful()
Indicates whether the match was successful or not.
|
int |
start() |
int |
start(int group) |
static Result |
success(String input,
String before,
String group)
Creates an instance of a successful result type.
|
String |
toString() |
protected SimpleResult(boolean succeeded,
String input,
String before,
String group,
boolean canStopMatching)
succeeded - the success flag.input - the matcher`s input string.before - the string before match, not null.group - the string group, not null.canStopMatching - public String getInput()
Resultpublic boolean isSuccessful()
ResultisSuccessful in interface Resulttrue if the match succeeded, or false otherwise.public String getBefore()
Resultnull.public boolean canStopMatching()
ResultcanStopMatching in interface Resultpublic int start()
start in interface MatchResultpublic int start(int group)
start in interface MatchResultpublic int end()
end in interface MatchResultpublic int end(int group)
end in interface MatchResultpublic String group()
group in interface MatchResultpublic String group(int group)
group in interface MatchResultpublic int groupCount()
groupCount in interface MatchResultpublic static Result success(String input, String before, String group)
Result.canStopMatching() is always set to true.input - the matcher`s input string.before - the string before match, not null.group - the string group, not null.public static Result failure(String input, boolean canStopMatching)
input - the input string.canStopMatching - indicates whether matching operation can be stopped.Copyright © 2014–2018 Alexey Gavrilov and contributors. All rights reserved.