com.partnersoft.io
Class RandomAccessDataRecordSource
java.lang.Object
com.partnersoft.io.AbstractIterableInput<Naming<java.lang.Object>>
com.partnersoft.io.DataRecordSource
com.partnersoft.io.RandomAccessDataRecordSource
- All Implemented Interfaces:
- Coggable, IterableInput<Naming<java.lang.Object>>, java.lang.Iterable<Naming<java.lang.Object>>
public abstract class RandomAccessDataRecordSource
- extends DataRecordSource
Superclass for DataRecordSources whose records can also be retrieved via a numeric index.
Provides a basic implementation of fetchImp() that keeps track of a recordCount and currentRecordNumber;
it simply iterates through the numbers 0 <= currentRecordNumber < recordCount.
You should set recordCount on open.
Copyright 2008 Partner Software, Inc.
- Version:
- $Id$
- Author:
- Paul Reavis
|
Method Summary |
protected boolean |
fetchImp()
Subclass implementation of guts of fetch() method. |
Naming<java.lang.Object> |
fetchRecordAt(int recordNumber)
Return the record at the given number. |
abstract java.lang.Object[] |
fetchValuesAt(int recordNumber)
Return the values for the record at the given number. |
int |
getRecordCount()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
currentRecordNumber
public int currentRecordNumber
recordCount
public int recordCount
RandomAccessDataRecordSource
public RandomAccessDataRecordSource()
fetchValuesAt
public abstract java.lang.Object[] fetchValuesAt(int recordNumber)
- Return the values for the record at the given number. Returns null if the fetch fails for any reason.
Subclasses must implement this to take care of the actual fetching.
- Parameters:
recordNumber - number of the record desired, starting with zero.
- Returns:
- values for the record at recordNumber
fetchRecordAt
public Naming<java.lang.Object> fetchRecordAt(int recordNumber)
- Return the record at the given number. Returns null if the fetch fails for any reason.
- Parameters:
recordNumber - number of the record desired, starting with zero.
- Returns:
- record at recordNumber
fetchImp
protected boolean fetchImp()
throws java.lang.Exception
- Description copied from class:
AbstractIterableInput
- Subclass implementation of guts of fetch() method.
Subclasses must implement this to do the actual work required by fetch().
Feel free to throw exceptions; these are caught inside the fetch() itself
and applied to the exception variable. Thus, you can focus on the actual
task instead of paperwork.
- Specified by:
fetchImp in class AbstractIterableInput<Naming<java.lang.Object>>
- Returns:
- true if fetch successful
- Throws:
java.lang.Exception
getRecordCount
public int getRecordCount()