You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/12/11 16:12:16 UTC
[commons-text] branch master updated: Better param name.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new 6d48016 Better param name.
6d48016 is described below
commit 6d480166479e9568b7b9cbaf02855ba395a95a12
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 11 11:12:12 2019 -0500
Better param name.
---
.../text/matcher/AbstractStringMatcher.java | 32 +++++++++++-----------
.../apache/commons/text/matcher/StringMatcher.java | 4 +--
.../apache/commons/text/TextStringBuilderTest.java | 8 +++---
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java b/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java
index 68c0ba1..f80e18c 100644
--- a/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java
+++ b/src/main/java/org/apache/commons/text/matcher/AbstractStringMatcher.java
@@ -52,7 +52,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
*
* @param buffer
* the text content to match against, do not change
- * @param pos
+ * @param start
* the starting position for the match, valid for buffer
* @param bufferStart
* the first active index in the buffer, valid for buffer
@@ -61,8 +61,8 @@ abstract class AbstractStringMatcher implements StringMatcher {
* @return The number of matching characters, zero for no match
*/
@Override
- public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
- return ch == buffer[pos] ? 1 : 0;
+ public int isMatch(final char[] buffer, final int start, final int bufferStart, final int bufferEnd) {
+ return ch == buffer[start] ? 1 : 0;
}
}
@@ -90,7 +90,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
*
* @param buffer
* the text content to match against, do not change
- * @param pos
+ * @param start
* the starting position for the match, valid for buffer
* @param bufferStart
* the first active index in the buffer, valid for buffer
@@ -99,8 +99,8 @@ abstract class AbstractStringMatcher implements StringMatcher {
* @return The number of matching characters, zero for no match
*/
@Override
- public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
- return Arrays.binarySearch(chars, buffer[pos]) >= 0 ? 1 : 0;
+ public int isMatch(final char[] buffer, final int start, final int bufferStart, final int bufferEnd) {
+ return Arrays.binarySearch(chars, buffer[start]) >= 0 ? 1 : 0;
}
}
@@ -121,7 +121,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
*
* @param buffer
* the text content to match against, do not change
- * @param pos
+ * @param start
* the starting position for the match, valid for buffer
* @param bufferStart
* the first active index in the buffer, valid for buffer
@@ -130,7 +130,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
* @return The number of matching characters, zero for no match
*/
@Override
- public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
+ public int isMatch(final char[] buffer, final int start, final int bufferStart, final int bufferEnd) {
return 0;
}
}
@@ -158,7 +158,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
*
* @param buffer
* the text content to match against, do not change
- * @param pos
+ * @param start
* the starting position for the match, valid for buffer
* @param bufferStart
* the first active index in the buffer, valid for buffer
@@ -167,13 +167,13 @@ abstract class AbstractStringMatcher implements StringMatcher {
* @return The number of matching characters, zero for no match
*/
@Override
- public int isMatch(final char[] buffer, int pos, final int bufferStart, final int bufferEnd) {
+ public int isMatch(final char[] buffer, int start, final int bufferStart, final int bufferEnd) {
final int len = chars.length;
- if (pos + len > bufferEnd) {
+ if (start + len > bufferEnd) {
return 0;
}
- for (int i = 0; i < chars.length; i++, pos++) {
- if (chars[i] != buffer[pos]) {
+ for (int i = 0; i < chars.length; i++, start++) {
+ if (chars[i] != buffer[start]) {
return 0;
}
}
@@ -209,7 +209,7 @@ abstract class AbstractStringMatcher implements StringMatcher {
*
* @param buffer
* the text content to match against, do not change
- * @param pos
+ * @param start
* the starting position for the match, valid for buffer
* @param bufferStart
* the first active index in the buffer, valid for buffer
@@ -218,8 +218,8 @@ abstract class AbstractStringMatcher implements StringMatcher {
* @return The number of matching characters, zero for no match
*/
@Override
- public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
- return buffer[pos] <= SPACE_INT ? 1 : 0;
+ public int isMatch(final char[] buffer, final int start, final int bufferStart, final int bufferEnd) {
+ return buffer[start] <= SPACE_INT ? 1 : 0;
}
}
diff --git a/src/main/java/org/apache/commons/text/matcher/StringMatcher.java b/src/main/java/org/apache/commons/text/matcher/StringMatcher.java
index b0569f9..681c211 100644
--- a/src/main/java/org/apache/commons/text/matcher/StringMatcher.java
+++ b/src/main/java/org/apache/commons/text/matcher/StringMatcher.java
@@ -46,7 +46,7 @@ public interface StringMatcher {
*
* @param buffer
* the text content to match against, do not change
- * @param pos
+ * @param start
* the starting position for the match, valid for buffer
* @param bufferStart
* the first active index in the buffer, valid for buffer
@@ -54,6 +54,6 @@ public interface StringMatcher {
* the end index (exclusive) of the active buffer, valid for buffer
* @return The number of matching characters, or zero if there is no match
*/
- int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd);
+ int isMatch(char[] buffer, int start, int bufferStart, int bufferEnd);
}
diff --git a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
index 78875a4..d659590 100644
--- a/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
+++ b/src/test/java/org/apache/commons/text/TextStringBuilderTest.java
@@ -1581,10 +1581,10 @@ public class TextStringBuilderTest {
assertEquals(23, sb.lastIndexOf(A_NUMBER_MATCHER, 24));
}
- static final StringMatcher A_NUMBER_MATCHER = (buffer, pos, bufferStart, bufferEnd) -> {
- if (buffer[pos] == 'A') {
- pos++;
- if (pos < bufferEnd && buffer[pos] >= '0' && buffer[pos] <= '9') {
+ static final StringMatcher A_NUMBER_MATCHER = (buffer, start, bufferStart, bufferEnd) -> {
+ if (buffer[start] == 'A') {
+ start++;
+ if (start < bufferEnd && buffer[start] >= '0' && buffer[start] <= '9') {
return 2;
}
}