summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO.txt1
-rw-r--r--src/java/com/healthmarketscience/jackcess/CursorBuilder.java2
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/CursorImpl.java173
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/IndexCursorImpl.java55
4 files changed, 9 insertions, 222 deletions
diff --git a/TODO.txt b/TODO.txt
index 28caeed..6ef29e4 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -44,3 +44,4 @@ Refactor goals:
- add @usage tags to util classes
* add unit tests for Row update/delete methods, add/update *FromMap methods
* add reason to unsupop throws for indexes
+- remove static methods in CursorImpl/IndexCursorImpl \ No newline at end of file
diff --git a/src/java/com/healthmarketscience/jackcess/CursorBuilder.java b/src/java/com/healthmarketscience/jackcess/CursorBuilder.java
index 8c4a725..92a9604 100644
--- a/src/java/com/healthmarketscience/jackcess/CursorBuilder.java
+++ b/src/java/com/healthmarketscience/jackcess/CursorBuilder.java
@@ -286,7 +286,7 @@ public class CursorBuilder {
if(_index == null) {
cursor = CursorImpl.createCursor(_table);
} else {
- cursor = CursorImpl.createIndexCursor(_table, _index,
+ cursor = IndexCursorImpl.createCursor(_table, _index,
_startRow, _startRowInclusive,
_endRow, _endRowInclusive);
}
diff --git a/src/java/com/healthmarketscience/jackcess/impl/CursorImpl.java b/src/java/com/healthmarketscience/jackcess/impl/CursorImpl.java
index cd818f2..e0d3938 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/CursorImpl.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/CursorImpl.java
@@ -44,7 +44,6 @@ import com.healthmarketscience.jackcess.util.ColumnMatcher;
import com.healthmarketscience.jackcess.Column;
import com.healthmarketscience.jackcess.Row;
import com.healthmarketscience.jackcess.RuntimeIOException;
-import com.healthmarketscience.jackcess.Index;
import com.healthmarketscience.jackcess.util.SimpleColumnMatcher;
/**
@@ -108,178 +107,6 @@ public abstract class CursorImpl implements Cursor
return new TableScanCursor(table);
}
- /**
- * Creates an indexed cursor for the given table.
- * <p>
- * Note, index based table traversal may not include all rows, as certain
- * types of indexes do not include all entries (namely, some indexes ignore
- * null entries, see {@link Index#shouldIgnoreNulls}).
- *
- * @param table the table over which this cursor will traverse
- * @param index index for the table which will define traversal order as
- * well as enhance certain lookups
- */
- public static CursorImpl createIndexCursor(TableImpl table, IndexImpl index)
- throws IOException
- {
- return IndexCursorImpl.createCursor(table, index);
- }
-
- /**
- * Creates an indexed cursor for the given table, narrowed to the given
- * range.
- * <p>
- * Note, index based table traversal may not include all rows, as certain
- * types of indexes do not include all entries (namely, some indexes ignore
- * null entries, see {@link Index#shouldIgnoreNulls}).
- *
- * @param table the table over which this cursor will traverse
- * @param index index for the table which will define traversal order as
- * well as enhance certain lookups
- * @param startRow the first row of data for the cursor (inclusive), or
- * {@code null} for the first entry
- * @param endRow the last row of data for the cursor (inclusive), or
- * {@code null} for the last entry
- */
- public static CursorImpl createIndexCursor(TableImpl table, IndexImpl index,
- Object[] startRow, Object[] endRow)
- throws IOException
- {
- return IndexCursorImpl.createCursor(table, index, startRow, endRow);
- }
-
- /**
- * Creates an indexed cursor for the given table, narrowed to the given
- * range.
- * <p>
- * Note, index based table traversal may not include all rows, as certain
- * types of indexes do not include all entries (namely, some indexes ignore
- * null entries, see {@link Index#shouldIgnoreNulls}).
- *
- * @param table the table over which this cursor will traverse
- * @param index index for the table which will define traversal order as
- * well as enhance certain lookups
- * @param startRow the first row of data for the cursor, or {@code null} for
- * the first entry
- * @param startInclusive whether or not startRow is inclusive or exclusive
- * @param endRow the last row of data for the cursor, or {@code null} for
- * the last entry
- * @param endInclusive whether or not endRow is inclusive or exclusive
- */
- public static CursorImpl createIndexCursor(TableImpl table, IndexImpl index,
- Object[] startRow,
- boolean startInclusive,
- Object[] endRow,
- boolean endInclusive)
- throws IOException
- {
- return IndexCursorImpl.createCursor(table, index, startRow, startInclusive,
- endRow, endInclusive);
- }
-
- /**
- * Convenience method for finding a specific row in a table which matches a
- * given row "pattern". See {@link #findFirstRow(Map)} for details on the
- * rowPattern.
- * <p>
- * Warning, this method <i>always</i> starts searching from the beginning of
- * the Table (you cannot use it to find successive matches).
- *
- * @param table the table to search
- * @param rowPattern pattern to be used to find the row
- * @return the matching row or {@code null} if a match could not be found.
- */
- public static Row findRow(TableImpl table, Map<String,?> rowPattern)
- throws IOException
- {
- CursorImpl cursor = createCursor(table);
- if(cursor.findFirstRow(rowPattern)) {
- return cursor.getCurrentRow();
- }
- return null;
- }
-
- /**
- * Convenience method for finding a specific row in a table which matches a
- * given row "pattern". See {@link #findFirstRow(Column,Object)} for
- * details on the pattern.
- * <p>
- * Note, a {@code null} result value is ambiguous in that it could imply no
- * match or a matching row with {@code null} for the desired value. If
- * distinguishing this situation is important, you will need to use a Cursor
- * directly instead of this convenience method.
- *
- * @param table the table to search
- * @param column column whose value should be returned
- * @param columnPattern column being matched by the valuePattern
- * @param valuePattern value from the columnPattern which will match the
- * desired row
- * @return the matching row or {@code null} if a match could not be found.
- */
- public static Object findValue(TableImpl table, ColumnImpl column,
- ColumnImpl columnPattern, Object valuePattern)
- throws IOException
- {
- CursorImpl cursor = createCursor(table);
- if(cursor.findFirstRow(columnPattern, valuePattern)) {
- return cursor.getCurrentRowValue(column);
- }
- return null;
- }
-
- /**
- * Convenience method for finding a specific row in an indexed table which
- * matches a given row "pattern". See {@link #findFirstRow(Map)} for
- * details on the rowPattern.
- * <p>
- * Warning, this method <i>always</i> starts searching from the beginning of
- * the Table (you cannot use it to find successive matches).
- *
- * @param table the table to search
- * @param index index to assist the search
- * @param rowPattern pattern to be used to find the row
- * @return the matching row or {@code null} if a match could not be found.
- */
- public static Row findRow(TableImpl table, IndexImpl index,
- Map<String,?> rowPattern)
- throws IOException
- {
- CursorImpl cursor = createIndexCursor(table, index);
- if(cursor.findFirstRow(rowPattern)) {
- return cursor.getCurrentRow();
- }
- return null;
- }
-
- /**
- * Convenience method for finding a specific row in a table which matches a
- * given row "pattern". See {@link #findFirstRow(Column,Object)} for
- * details on the pattern.
- * <p>
- * Note, a {@code null} result value is ambiguous in that it could imply no
- * match or a matching row with {@code null} for the desired value. If
- * distinguishing this situation is important, you will need to use a Cursor
- * directly instead of this convenience method.
- *
- * @param table the table to search
- * @param index index to assist the search
- * @param column column whose value should be returned
- * @param columnPattern column being matched by the valuePattern
- * @param valuePattern value from the columnPattern which will match the
- * desired row
- * @return the matching row or {@code null} if a match could not be found.
- */
- public static Object findValue(TableImpl table, IndexImpl index, ColumnImpl column,
- ColumnImpl columnPattern, Object valuePattern)
- throws IOException
- {
- CursorImpl cursor = createIndexCursor(table, index);
- if(cursor.findFirstRow(columnPattern, valuePattern)) {
- return cursor.getCurrentRowValue(column);
- }
- return null;
- }
-
public RowState getRowState() {
return _rowState;
}
diff --git a/src/java/com/healthmarketscience/jackcess/impl/IndexCursorImpl.java b/src/java/com/healthmarketscience/jackcess/impl/IndexCursorImpl.java
index 0407c15..3b76fa8 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/IndexCursorImpl.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/IndexCursorImpl.java
@@ -29,7 +29,6 @@ import java.util.Set;
import com.healthmarketscience.jackcess.IndexCursor;
import com.healthmarketscience.jackcess.Row;
-import com.healthmarketscience.jackcess.RowId;
import com.healthmarketscience.jackcess.RuntimeIOException;
import com.healthmarketscience.jackcess.impl.TableImpl.RowState;
import com.healthmarketscience.jackcess.util.CaseInsensitiveColumnMatcher;
@@ -71,46 +70,6 @@ public class IndexCursorImpl extends CursorImpl implements IndexCursor
_index.initialize();
_entryCursor = entryCursor;
}
-
- /**
- * Creates an indexed cursor for the given table.
- * <p>
- * Note, index based table traversal may not include all rows, as certain
- * types of indexes do not include all entries (namely, some indexes ignore
- * null entries, see {@link Index#shouldIgnoreNulls}).
- *
- * @param table the table over which this cursor will traverse
- * @param index index for the table which will define traversal order as
- * well as enhance certain lookups
- */
- public static IndexCursorImpl createCursor(TableImpl table, IndexImpl index)
- throws IOException
- {
- return createCursor(table, index, null, null);
- }
-
- /**
- * Creates an indexed cursor for the given table, narrowed to the given
- * range.
- * <p>
- * Note, index based table traversal may not include all rows, as certain
- * types of indexes do not include all entries (namely, some indexes ignore
- * null entries, see {@link Index#shouldIgnoreNulls}).
- *
- * @param table the table over which this cursor will traverse
- * @param index index for the table which will define traversal order as
- * well as enhance certain lookups
- * @param startRow the first row of data for the cursor (inclusive), or
- * {@code null} for the first entry
- * @param endRow the last row of data for the cursor (inclusive), or
- * {@code null} for the last entry
- */
- public static IndexCursorImpl createCursor(
- TableImpl table, IndexImpl index, Object[] startRow, Object[] endRow)
- throws IOException
- {
- return createCursor(table, index, startRow, true, endRow, true);
- }
/**
* Creates an indexed cursor for the given table, narrowed to the given
@@ -131,10 +90,10 @@ public class IndexCursorImpl extends CursorImpl implements IndexCursor
* @param endInclusive whether or not endRow is inclusive or exclusive
*/
public static IndexCursorImpl createCursor(TableImpl table, IndexImpl index,
- Object[] startRow,
- boolean startInclusive,
- Object[] endRow,
- boolean endInclusive)
+ Object[] startRow,
+ boolean startInclusive,
+ Object[] endRow,
+ boolean endInclusive)
throws IOException
{
if(table != index.getTable()) {
@@ -152,9 +111,9 @@ public class IndexCursorImpl extends CursorImpl implements IndexCursor
" is not usable for indexed lookups due to " +
index.getIndexData().getUnsupportedReason());
}
- IndexCursorImpl cursor = new IndexCursorImpl(table, index,
- index.cursor(startRow, startInclusive,
- endRow, endInclusive));
+ IndexCursorImpl cursor = new IndexCursorImpl(
+ table, index, index.cursor(startRow, startInclusive,
+ endRow, endInclusive));
// init the column matcher appropriately for the index type
cursor.setColumnMatcher(null);
return cursor;