Class AbstractStringMatcher.CharSetMatcher
java.lang.Object
org.apache.commons.text.matcher.AbstractStringMatcher
org.apache.commons.text.matcher.AbstractStringMatcher.CharSetMatcher
- All Implemented Interfaces:
StringMatcher
- Enclosing class:
AbstractStringMatcher
Matches a set of characters.
Thread=safe.
- Since:
- 1.3
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractStringMatcher
AbstractStringMatcher.AndStringMatcher, AbstractStringMatcher.CharArrayMatcher, AbstractStringMatcher.CharMatcher, AbstractStringMatcher.CharSetMatcher, AbstractStringMatcher.NoneMatcher, AbstractStringMatcher.TrimMatcher -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintisMatch(char[] buffer, int start, int bufferStart, int bufferEnd) Returns1if there is a match, or0if there is no match.intisMatch(CharSequence buffer, int start, int bufferStart, int bufferEnd) Returns1if there is a match, or0if there is no match.intsize()Returns 1.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface StringMatcher
andThen, isMatch, isMatch
-
Field Details
-
chars
private final char[] charsThe set of characters to match.
-
-
Constructor Details
-
CharSetMatcher
CharSetMatcher(char[] chars) Constructs a matcher from a character array.- Parameters:
chars- the characters to match, must not be null.
-
-
Method Details
-
isMatch
public int isMatch(char[] buffer, int start, int bufferStart, int bufferEnd) Returns1if there is a match, or0if there is no match.- Parameters:
buffer- the text content to match against, do not change.start- the starting position for the match, valid for buffer.bufferStart- unused.bufferEnd- unused.- Returns:
- The number of matching characters, zero for no match.
-
isMatch
Returns1if there is a match, or0if there is no match.- Parameters:
buffer- the text content to match against, do not change.start- the starting position for the match, valid for buffer.bufferStart- unused.bufferEnd- unused.- Returns:
- The number of matching characters, zero for no match.
-
size
public int size()Returns 1.- Returns:
- the size of the matching string.
- Since:
- 1.9
-
toString
-