Browse Source

add constants for movement booleans

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@308 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/rel_1_1_14
James Ahlborn 16 years ago
parent
commit
a85e7e333e

+ 21
- 15
src/java/com/healthmarketscience/jackcess/Cursor.java View File

@@ -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();
}
}

+ 4
- 4
src/java/com/healthmarketscience/jackcess/UsageMap.java View File

@@ -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);
}

/**

Loading…
Cancel
Save