public abstract class AbstractRecordSource extends Object implements RecordSource
RecordSource. Provides
implementations for all methods except RecordSource.getCurrentRecord().
As implemented, this source supports no positioning operations. All supportsXXX methods
return false. All hasXXX methods forward the call to supportsXXX.
All positioning methods throw UnsupportedOperationException.
A typical subclass that supports a certain subset of access modes will only need to override
methods corresponding to those modes. For example, a simple sequential access source
with no rewind capability will override supportsNext(), hasNext(), next(),
and possibly size() if the number of records in the source is known.
| Constructor and Description |
|---|
AbstractRecordSource() |
AbstractRecordSource(String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the record source and release any associated resources.
|
void |
current()
Reloads the current record.
|
long |
getCurrentIndex()
Returns the index of the current record.
|
RecordTag |
getCurrentTag()
Returns the tag of the current record.
|
long |
getEstimatedSize()
Returns the estimated number of records in this source.
|
String |
getName()
Returns the name of this source.
|
Class<?> |
getRecordClass()
Returns the Class object that is guaranteed to be a superclass of all records in this source.
|
List<RecordTag> |
getTags()
Returns a list of tags for events in this source.
|
boolean |
hasCurrent()
Returns true if this source can reload the current record.
|
boolean |
hasIndex(long index)
Returns true if this source has a record with the specified index.
|
boolean |
hasNext()
Returns true if this source can load the next record.
|
boolean |
hasPrevious()
Returns true if this source can load the previous record.
|
boolean |
hasRewind()
Returns true if this source in its current state can be rewound.
|
boolean |
hasShift(long numberOfRecords)
Returns true if this source can shift by numberOfRecords records.
|
boolean |
hasTag(RecordTag tag)
Returns true if this source has a record with the specified tag.
|
void |
jump(long index)
Loads the record specified by the index.
|
void |
jump(RecordTag tag)
Loads the record specified by the tag.
|
void |
jump(String tagName)
Loads the record specified by name.
|
void |
next()
Loads the next record.
|
RecordTag |
parseTag(String s)
Returns a tag corresponding to the specified string.
|
void |
previous()
Loads the previous record.
|
void |
releaseRecord()
Releases any resources associated with the current record.
|
void |
rewind()
Positions the cursor of this source before the first record.
|
void |
setName(String name) |
void |
shift(long numberOfRecords)
Loads the record specified by the offset with respect to the current cursor position.
|
long |
size()
Returns the number of records in this source.
|
boolean |
supportsCurrent()
Returns true if this source supports reloading current record.
|
boolean |
supportsIndex()
Returns true if this source supports selecting records by index.
|
boolean |
supportsNext()
Returns true if this source supports loading next record.
|
boolean |
supportsPrevious()
Returns true if this source supports loading previous record.
|
boolean |
supportsRewind()
Returns true if this source supports rewind operation.
|
boolean |
supportsShift()
Returns true if this source supports selecting records by offset with respect to the current record.
|
boolean |
supportsTag()
Returns true if this source supports selecting records by tag.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCurrentRecordpublic AbstractRecordSource()
public AbstractRecordSource(String name)
public void setName(String name)
public String getName()
getName in interface RecordSourcepublic Class<?> getRecordClass()
Implemented to return Object.class.
getRecordClass in interface RecordSourcepublic long size()
Implemented to throw UnsupportedOperationException.
size in interface RecordSourcepublic long getEstimatedSize()
Implemented to forward the call to size().
getEstimatedSize in interface RecordSourcepublic List<RecordTag> getTags()
Implemented to throw UnsupportedOperationException.
getTags in interface RecordSourcepublic long getCurrentIndex()
Implemented to throw UnsupportedOperationException.
getCurrentIndex in interface RecordSourcepublic RecordTag getCurrentTag()
Implemented to throw UnsupportedOperationException.
getCurrentTag in interface RecordSourcepublic void releaseRecord()
Implemented to do nothing.
releaseRecord in interface RecordSourcepublic boolean supportsCurrent()
supportsCurrent in interface RecordSourcepublic boolean supportsNext()
supportsNext in interface RecordSourcepublic boolean supportsPrevious()
supportsPrevious in interface RecordSourcepublic boolean supportsIndex()
supportsIndex in interface RecordSourcepublic boolean supportsTag()
supportsTag in interface RecordSourcepublic boolean supportsShift()
supportsShift in interface RecordSourcepublic boolean hasCurrent()
hasCurrent in interface RecordSourcepublic boolean hasNext()
hasNext in interface RecordSourcepublic boolean hasPrevious()
hasPrevious in interface RecordSourcepublic boolean hasIndex(long index)
hasIndex in interface RecordSourcepublic boolean hasTag(RecordTag tag)
hasTag in interface RecordSourcepublic boolean hasShift(long numberOfRecords)
hasShift in interface RecordSourcepublic void current()
throws IOException,
NoSuchRecordException
current in interface RecordSourceIOException - if reloading of the current record fails.NoSuchRecordException - if there is no current record.public void next()
throws IOException,
NoSuchRecordException
next in interface RecordSourceIOException - if loading of the next record fails.NoSuchRecordException - if there is no next record.public void previous()
throws IOException,
NoSuchRecordException
previous in interface RecordSourceIOException - if loading of the previous record fails.NoSuchRecordException - if there is no previous record.public void jump(long index)
throws IOException,
NoSuchRecordException
jump in interface RecordSourceIOException - if loading of the requested record fails.NoSuchRecordException - if this source does not have a record with the specified index.public void jump(RecordTag tag) throws IOException, NoSuchRecordException
jump in interface RecordSourceIOException - if loading of the requested record fails.NoSuchRecordException - if this source does not have a record with the specified tag.public void shift(long numberOfRecords)
throws IOException,
NoSuchRecordException
shift in interface RecordSourceIOException - if loading of the requested record fails.NoSuchRecordException - if this source does not have a record with the specified offset.public void jump(String tagName) throws IOException, NoSuchRecordException
parseTag(String).IOExceptionNoSuchRecordExceptionpublic boolean supportsRewind()
supportsRewind in interface RecordSourcepublic boolean hasRewind()
hasRewind in interface RecordSourcepublic void rewind()
throws IOException
rewind in interface RecordSourceIOException - if rewinding fails for any reason.public void close()
throws IOException
Implemented to do nothing.
close in interface RecordSourceIOException - if closing fails.public RecordTag parseTag(String s)
Implemented to return an instance of DefaultRecordTag with the specified name.
parseTag in interface RecordSourceCopyright © 2000-2012 FreeHEP. All Rights Reserved.