summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-04-05 03:28:11 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-04-05 03:28:11 +0000
commita85e7e333ec97a7b5779912f32ffb628aae3fa29 (patch)
treed61e5a9cd68dee0edfa4bd692ff000ab6ddd8f9e
parentea664f7a7de7255a6a2abec707eddad54312780d (diff)
downloadjackcess-a85e7e333ec97a7b5779912f32ffb628aae3fa29.tar.gz
jackcess-a85e7e333ec97a7b5779912f32ffb628aae3fa29.zip
add constants for movement booleans
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@308 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/java/com/healthmarketscience/jackcess/Cursor.java36
-rw-r--r--src/java/com/healthmarketscience/jackcess/UsageMap.java8
2 files changed, 25 insertions, 19 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Cursor.java b/src/java/com/healthmarketscience/jackcess/Cursor.java
index da54d63..b3ae216 100644
--- a/src/java/com/healthmarketscience/jackcess/Cursor.java
+++ b/src/java/com/healthmarketscience/jackcess/Cursor.java
@@ -60,6 +60,11 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
{
private static final Log LOG = LogFactory.getLog(Cursor.class);
+ /** boolean value indicating forward movement */
+ public static final boolean MOVE_FORWARD = true;
+ /** boolean value indicating reverse movement */
+ public static final boolean MOVE_REVERSE = false;
+
/** first position for the TableScanCursor */
private static final ScanPosition FIRST_SCAN_POSITION =
new ScanPosition(RowId.FIRST_ROW_ID);
@@ -333,7 +338,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
* row).
*/
public void beforeFirst() {
- reset(true);
+ reset(MOVE_FORWARD);
}
/**
@@ -341,7 +346,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
* row).
*/
public void afterLast() {
- reset(false);
+ reset(MOVE_REVERSE);
}
/**
@@ -352,7 +357,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
throws IOException
{
if(getFirstPosition().equals(_curPos)) {
- return !recheckPosition(false);
+ return !recheckPosition(MOVE_REVERSE);
}
return false;
}
@@ -365,7 +370,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
throws IOException
{
if(getLastPosition().equals(_curPos)) {
- return !recheckPosition(true);
+ return !recheckPosition(MOVE_FORWARD);
}
return false;
}
@@ -418,7 +423,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
{
return new Iterable<Map<String, Object>>() {
public Iterator<Map<String, Object>> iterator() {
- return new RowIterator(columnNames, false);
+ return new RowIterator(columnNames, MOVE_REVERSE);
}
};
}
@@ -462,7 +467,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
*/
public Iterator<Map<String, Object>> iterator(Collection<String> columnNames)
{
- return new RowIterator(columnNames, true);
+ return new RowIterator(columnNames, MOVE_FORWARD);
}
/**
@@ -492,7 +497,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
public Map<String, Object> getNextRow(Collection<String> columnNames)
throws IOException
{
- return getAnotherRow(columnNames, true);
+ return getAnotherRow(columnNames, MOVE_FORWARD);
}
/**
@@ -513,7 +518,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
public Map<String, Object> getPreviousRow(Collection<String> columnNames)
throws IOException
{
- return getAnotherRow(columnNames, false);
+ return getAnotherRow(columnNames, MOVE_REVERSE);
}
@@ -543,7 +548,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
public boolean moveToNextRow()
throws IOException
{
- return moveToAnotherRow(true);
+ return moveToAnotherRow(MOVE_FORWARD);
}
/**
@@ -554,7 +559,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
public boolean moveToPreviousRow()
throws IOException
{
- return moveToAnotherRow(false);
+ return moveToAnotherRow(MOVE_REVERSE);
}
/**
@@ -783,7 +788,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
public int moveNextRows(int numRows)
throws IOException
{
- return moveSomeRows(numRows, true);
+ return moveSomeRows(numRows, MOVE_FORWARD);
}
/**
@@ -793,7 +798,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
public int movePreviousRows(int numRows)
throws IOException
{
- return moveSomeRows(numRows, false);
+ return moveSomeRows(numRows, MOVE_REVERSE);
}
/**
@@ -1244,7 +1249,8 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
* cursor logic from value storage.
*/
private abstract class IndexDirHandler extends DirHandler {
- public abstract Index.Entry getAnotherEntry();
+ public abstract Index.Entry getAnotherEntry()
+ throws IOException;
}
/**
@@ -1260,7 +1266,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
return getLastPosition();
}
@Override
- public Index.Entry getAnotherEntry() {
+ public Index.Entry getAnotherEntry() throws IOException {
return _entryCursor.getNextEntry();
}
}
@@ -1278,7 +1284,7 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
return getFirstPosition();
}
@Override
- public Index.Entry getAnotherEntry() {
+ public Index.Entry getAnotherEntry() throws IOException {
return _entryCursor.getPreviousEntry();
}
}
diff --git a/src/java/com/healthmarketscience/jackcess/UsageMap.java b/src/java/com/healthmarketscience/jackcess/UsageMap.java
index 9b286e6..8e40f4d 100644
--- a/src/java/com/healthmarketscience/jackcess/UsageMap.java
+++ b/src/java/com/healthmarketscience/jackcess/UsageMap.java
@@ -769,7 +769,7 @@ public class UsageMap
* {@link RowId#LAST_PAGE_NUMBER} otherwise
*/
public int getNextPage() {
- return getAnotherPage(true);
+ return getAnotherPage(Cursor.MOVE_FORWARD);
}
/**
@@ -777,7 +777,7 @@ public class UsageMap
* {@link RowId#FIRST_PAGE_NUMBER} otherwise
*/
public int getPreviousPage() {
- return getAnotherPage(false);
+ return getAnotherPage(Cursor.MOVE_REVERSE);
}
/**
@@ -815,7 +815,7 @@ public class UsageMap
* page in the map
*/
public void beforeFirst() {
- reset(true);
+ reset(Cursor.MOVE_FORWARD);
}
/**
@@ -823,7 +823,7 @@ public class UsageMap
* last page in the map
*/
public void afterLast() {
- reset(false);
+ reset(Cursor.MOVE_REVERSE);
}
/**