{
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);
* row).
*/
public void beforeFirst() {
- reset(true);
+ reset(MOVE_FORWARD);
}
/**
* row).
*/
public void afterLast() {
- reset(false);
+ reset(MOVE_REVERSE);
}
/**
throws IOException
{
if(getFirstPosition().equals(_curPos)) {
- return !recheckPosition(false);
+ return !recheckPosition(MOVE_REVERSE);
}
return false;
}
throws IOException
{
if(getLastPosition().equals(_curPos)) {
- return !recheckPosition(true);
+ return !recheckPosition(MOVE_FORWARD);
}
return false;
}
{
return new Iterable<Map<String, Object>>() {
public Iterator<Map<String, Object>> iterator() {
- return new RowIterator(columnNames, false);
+ return new RowIterator(columnNames, MOVE_REVERSE);
}
};
}
*/
public Iterator<Map<String, Object>> iterator(Collection<String> columnNames)
{
- return new RowIterator(columnNames, true);
+ return new RowIterator(columnNames, MOVE_FORWARD);
}
/**
public Map<String, Object> getNextRow(Collection<String> columnNames)
throws IOException
{
- return getAnotherRow(columnNames, true);
+ return getAnotherRow(columnNames, MOVE_FORWARD);
}
/**
public Map<String, Object> getPreviousRow(Collection<String> columnNames)
throws IOException
{
- return getAnotherRow(columnNames, false);
+ return getAnotherRow(columnNames, MOVE_REVERSE);
}
public boolean moveToNextRow()
throws IOException
{
- return moveToAnotherRow(true);
+ return moveToAnotherRow(MOVE_FORWARD);
}
/**
public boolean moveToPreviousRow()
throws IOException
{
- return moveToAnotherRow(false);
+ return moveToAnotherRow(MOVE_REVERSE);
}
/**
public int moveNextRows(int numRows)
throws IOException
{
- return moveSomeRows(numRows, true);
+ return moveSomeRows(numRows, MOVE_FORWARD);
}
/**
public int movePreviousRows(int numRows)
throws IOException
{
- return moveSomeRows(numRows, false);
+ return moveSomeRows(numRows, MOVE_REVERSE);
}
/**
* cursor logic from value storage.
*/
private abstract class IndexDirHandler extends DirHandler {
- public abstract Index.Entry getAnotherEntry();
+ public abstract Index.Entry getAnotherEntry()
+ throws IOException;
}
/**
return getLastPosition();
}
@Override
- public Index.Entry getAnotherEntry() {
+ public Index.Entry getAnotherEntry() throws IOException {
return _entryCursor.getNextEntry();
}
}
return getFirstPosition();
}
@Override
- public Index.Entry getAnotherEntry() {
+ public Index.Entry getAnotherEntry() throws IOException {
return _entryCursor.getPreviousEntry();
}
}