Class AbstractStringMatcher.AndStringMatcher
- java.lang.Object
-
- org.apache.commons.text.matcher.AbstractStringMatcher
-
- org.apache.commons.text.matcher.AbstractStringMatcher.AndStringMatcher
-
- All Implemented Interfaces:
StringMatcher
- Enclosing class:
- AbstractStringMatcher
static final class AbstractStringMatcher.AndStringMatcher extends AbstractStringMatcher
Matches all of the given matchers in order.- Since:
- 1.9
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.text.matcher.AbstractStringMatcher
AbstractStringMatcher.AndStringMatcher, AbstractStringMatcher.CharArrayMatcher, AbstractStringMatcher.CharMatcher, AbstractStringMatcher.CharSetMatcher, AbstractStringMatcher.NoneMatcher, AbstractStringMatcher.TrimMatcher
-
-
Constructor Summary
Constructors Constructor Description AndStringMatcher(StringMatcher... stringMatchers)Constructs a new initialized instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intisMatch(char[] buffer, int start, int bufferStart, int bufferEnd)Returns the number of matching characters,0if there is no match.intisMatch(CharSequence buffer, int start, int bufferStart, int bufferEnd)Returns the number of matching characters,0if there is no match.intsize()Returns the size of the matching string.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.text.matcher.StringMatcher
andThen, isMatch, isMatch
-
-
-
-
Constructor Detail
-
AndStringMatcher
AndStringMatcher(StringMatcher... stringMatchers)
Constructs a new initialized instance.- Parameters:
stringMatchers- Matchers in order. Never null since theStringMatcherFactoryuses theAbstractStringMatcher.NoneMatcherinstead.
-
-
Method Detail
-
isMatch
public int isMatch(char[] buffer, int start, int bufferStart, int bufferEnd)Description copied from interface:StringMatcherReturns the number of matching characters,0if there is no match.This method is called to check for a match against a source
buffer. The parameterstartrepresents the start position to be checked in thebuffer(a character array which MUST not be changed). The implementation SHOULD guarantees thatstartis a valid index inbuffer.The character array may be larger than the active area to be matched. Only values in the buffer between the specified indices may be accessed, in other words:
bufferStart <= start < bufferEnd.The matching code may check one character or many. It may check characters preceding
startas well as those after, so long as no checks exceed the bounds specified.It must return zero for no match, or a positive number if a match was found. The number indicates the number of characters that matched.
- Parameters:
buffer- the source text to search, do not change.start- the starting position for the match, valid inbuffer.bufferStart- the first active index in the buffer, valid inbuffer.bufferEnd- the end index (exclusive) of the active buffer, valid inbuffer.- Returns:
- The number of matching characters, zero if there is no match.
-
isMatch
public int isMatch(CharSequence buffer, int start, int bufferStart, int bufferEnd)
Description copied from interface:StringMatcherReturns the number of matching characters,0if there is no match.This method is called to check for a match against a source
buffer. The parameterstartrepresents the start position to be checked in thebuffer(a character array which MUST not be changed). The implementation SHOULD guarantees thatstartis a valid index inbuffer.The character array may be larger than the active area to be matched. Only values in the buffer between the specified indices may be accessed, in other words:
bufferStart <= start < bufferEnd.The matching code may check one character or many. It may check characters preceding
startas well as those after, so long as no checks exceed the bounds specified.It must return zero for no match, or a positive number if a match was found. The number indicates the number of characters that matched.
- Parameters:
buffer- the source text to search, do not change.start- the starting position for the match, valid inbuffer.bufferStart- the first active index in the buffer, valid inbuffer.bufferEnd- the end index (exclusive) of the active buffer, valid inbuffer.- Returns:
- The number of matching characters, zero if there is no match.
-
size
public int size()
Description copied from interface:StringMatcherReturns the size of the matching string. Defaults to 0.- Returns:
- the size of the matching string.
-
-