summaryrefslogtreecommitdiffstats
path: root/src/java/com/healthmarketscience/jackcess/UsageMap.java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2007-11-27 05:17:11 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2007-11-27 05:17:11 +0000
commitf2e4657a456de91d19e88d0b208f1d592a2071d2 (patch)
treec2966ebe8e1bf94b2e7aedfca1d2b1b849cd3645 /src/java/com/healthmarketscience/jackcess/UsageMap.java
parent59ae9fca1910244e5c39b7e6d1a3a6d3b078744b (diff)
downloadjackcess-f2e4657a456de91d19e88d0b208f1d592a2071d2.tar.gz
jackcess-f2e4657a456de91d19e88d0b208f1d592a2071d2.zip
finish reworking index cursor
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@185 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/java/com/healthmarketscience/jackcess/UsageMap.java')
-rw-r--r--src/java/com/healthmarketscience/jackcess/UsageMap.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/UsageMap.java b/src/java/com/healthmarketscience/jackcess/UsageMap.java
index e43fe6e..eee726a 100644
--- a/src/java/com/healthmarketscience/jackcess/UsageMap.java
+++ b/src/java/com/healthmarketscience/jackcess/UsageMap.java
@@ -775,7 +775,7 @@ public class UsageMap
}
/**
- * Gets another page in the given direction, returning the current page.
+ * Gets another page in the given direction, returning the new page.
*/
private int getAnotherPage(boolean moveForward) {
DirHandler handler = getDirHandler(moveForward);
@@ -835,13 +835,24 @@ public class UsageMap
private void restorePosition(int curPageNumber) {
_prevPageNumber = _curPageNumber;
_curPageNumber = curPageNumber;
- checkForModification();
+ _lastModCount = UsageMap.this._modCount;
}
+ /**
+ * Checks the usage map for modifications an updates state accordingly.
+ */
private void checkForModification() {
- // since we store page numbers, we don't need to adjust anything
+ // since page numbers are not affected by modifications, we don't need
+ // to adjust anything
_lastModCount = UsageMap.this._modCount;
}
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " CurPosition " + _curPageNumber +
+ ", PrevPosition " + _prevPageNumber;
+ }
+
/**
* Handles moving the cursor in a given direction. Separates cursor
@@ -859,7 +870,7 @@ public class UsageMap
private final class ForwardDirHandler extends DirHandler {
@Override
public int getAnotherPageNumber(int curPageNumber) {
- if(curPageNumber == RowId.FIRST_PAGE_NUMBER) {
+ if(curPageNumber == getBeginningPageNumber()) {
return UsageMap.this.getFirstPageNumber();
}
return UsageMap.this.getNextPageNumber(curPageNumber);
@@ -880,7 +891,7 @@ public class UsageMap
private final class ReverseDirHandler extends DirHandler {
@Override
public int getAnotherPageNumber(int curPageNumber) {
- if(curPageNumber == RowId.LAST_PAGE_NUMBER) {
+ if(curPageNumber == getBeginningPageNumber()) {
return UsageMap.this.getLastPageNumber();
}
return UsageMap.this.getPrevPageNumber(curPageNumber);