diff --git a/pom.xml b/pom.xml
index 7405ca6..5464af8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
org.spacious-team
table-wrapper-api
- 2022.2
+ 2022.4
jar
Table Wrapper API
@@ -56,14 +56,14 @@
org.projectlombok
lombok
- 1.18.18
+ 1.18.22
provided
true
org.slf4j
slf4j-api
- 1.7.30
+ 1.7.36
provided
diff --git a/src/main/java/org/spacious_team/table_wrapper/api/AbstractTable.java b/src/main/java/org/spacious_team/table_wrapper/api/AbstractTable.java
index de00cc3..e6ed686 100644
--- a/src/main/java/org/spacious_team/table_wrapper/api/AbstractTable.java
+++ b/src/main/java/org/spacious_team/table_wrapper/api/AbstractTable.java
@@ -231,6 +231,16 @@ public TableRow next() {
@Override
public TableRow findRow(Object value) {
TableCellAddress address = reportPage.find(value);
+ return getMutableTableRow(address);
+ }
+
+ @Override
+ public TableRow findRowByPrefix(String prefix) {
+ TableCellAddress address = reportPage.findByPrefix(prefix);
+ return getMutableTableRow(address);
+ }
+
+ private MutableTableRow getMutableTableRow(TableCellAddress address) {
if (tableRange.contains(address)) {
MutableTableRow tableRow = new MutableTableRow<>(this, getCellDataAccessObject());
tableRow.setRow(reportPage.getRow(address.getRow()));
diff --git a/src/main/java/org/spacious_team/table_wrapper/api/MutableTableRow.java b/src/main/java/org/spacious_team/table_wrapper/api/MutableTableRow.java
index 5c8f345..d5dc9e3 100644
--- a/src/main/java/org/spacious_team/table_wrapper/api/MutableTableRow.java
+++ b/src/main/java/org/spacious_team/table_wrapper/api/MutableTableRow.java
@@ -65,8 +65,8 @@ public int getLastCellNum() {
}
@Override
- public boolean rowContains(Object value) {
- return row.rowContains(value);
+ public boolean rowContains(Object expected) {
+ return row.rowContains(expected);
}
@Override
diff --git a/src/main/java/org/spacious_team/table_wrapper/api/ReportPage.java b/src/main/java/org/spacious_team/table_wrapper/api/ReportPage.java
index 2453f68..16192fb 100644
--- a/src/main/java/org/spacious_team/table_wrapper/api/ReportPage.java
+++ b/src/main/java/org/spacious_team/table_wrapper/api/ReportPage.java
@@ -18,64 +18,149 @@
package org.spacious_team.table_wrapper.api;
-import java.util.function.BiPredicate;
+import java.util.function.Predicate;
-public interface ReportPage {
+import static org.spacious_team.table_wrapper.api.ReportPageHelper.getCellStringValueIgnoreCasePrefixPredicate;
- BiPredicate CELL_STRING_STARTS_WITH = (cell, searchingValue) ->
- searchingValue != null && cell.trim().toLowerCase().startsWith(searchingValue.toString().trim().toLowerCase());
+public interface ReportPage {
/**
- * @return table table cell address or {@link TableCellAddress#NOT_FOUND}
+ * Finds cell address containing exact value.
+ *
+ * @return cell address or {@link TableCellAddress#NOT_FOUND}
*/
default TableCellAddress find(Object value) {
return find(value, 0);
}
/**
- * @return table table cell address or {@link TableCellAddress#NOT_FOUND}
+ * Finds cell address containing exact value.
+ *
+ * @param startRow search rows start from this
+ * @return cell address or {@link TableCellAddress#NOT_FOUND}
*/
default TableCellAddress find(Object value, int startRow) {
return find(value, startRow, Integer.MAX_VALUE);
}
/**
+ * Finds cell address containing exact value.
+ *
* @param startRow search rows start from this
* @param endRow search rows excluding this, can handle values greater than real rows count
- * @return table table cell address or {@link TableCellAddress#NOT_FOUND}
+ * @return cell address or {@link TableCellAddress#NOT_FOUND}
*/
default TableCellAddress find(Object value, int startRow, int endRow) {
- return find(value, startRow, endRow, ReportPage.CELL_STRING_STARTS_WITH);
+ return find(value, startRow, endRow, 0, Integer.MAX_VALUE);
+ }
+
+ /**
+ * Finds cell address containing exact value.
+ *
+ * @param value searching value
+ * @param startRow search rows start from this
+ * @param endRow search rows excluding this, can handle values greater than real rows count
+ * @param startColumn search columns start from this
+ * @param endColumn search columns excluding this, can handle values greater than real columns count
+ * @return cell address or {@link TableCellAddress#NOT_FOUND}
+ */
+ TableCellAddress find(Object value, int startRow, int endRow, int startColumn, int endColumn);
+
+ /**
+ * Finds cell by predicate.
+ *
+ * @param cellValuePredicate predicate for testing cell value
+ * @return cell address or {@link TableCellAddress#NOT_FOUND}
+ */
+ default TableCellAddress find(Predicate