public abstract class AbstractDataset extends java.lang.Object implements IDataset
IDataset abstract implementation
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractDataset.Instance
Implementation of the IInstance interface
|
IDataset.IInstance
Modifier and Type | Field and Description |
---|---|
protected AbstractDataset.Instance |
cursorInstance
Instance at cursor position
|
protected int |
cursorPosition
Cursor position
|
protected Metadata |
metadata
Dataset specification
|
protected java.lang.String |
name
Dataset name
|
Constructor and Description |
---|
AbstractDataset()
Empty constructor
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Close dataset
|
int |
getCursorPosition()
Returns the cursor position
|
IMetadata |
getMetadata()
Access to this dataset specification
|
java.lang.String |
getName()
Get name of this dataset
|
abstract boolean |
move(int index)
Move cursor to index position
|
abstract boolean |
next()
Return the next instance
|
int |
numberOfInstances()
Get the number of Instances.
|
abstract void |
open()
Open dataset
|
int |
read(IDataset.IInstance[] buffer)
Reads some number of instances from the dataset and stores them
into a buffer array.
|
int |
read(IDataset.IInstance[] b,
int off,
int len)
Returns cursor instance
|
IDataset.IInstance |
read(int rowNumber)
Reads instance at specified row number
|
abstract void |
reset()
Reset dataset
|
void |
setName(java.lang.String name)
Sets the name of this dataset
|
protected java.lang.String name
protected Metadata metadata
protected int cursorPosition
protected AbstractDataset.Instance cursorInstance
public final void setName(java.lang.String name)
Sets the name of this dataset
name
- New name of the datasetpublic java.lang.String getName()
Get name of this dataset
public IMetadata getMetadata()
Access to this dataset specification
getMetadata
in interface IDataset
public abstract void open() throws DatasetException
Open dataset
open
in interface IDataset
DatasetException
- If dataset can't be openedpublic abstract void close() throws DatasetException
Close dataset
close
in interface IDataset
DatasetException
- If dataset can't be closedpublic int getCursorPosition()
Returns the cursor position
public int numberOfInstances() throws DatasetException
Get the number of Instances. This implementation uses the reset and next methods. Current cursor position is stored into a temporary variable and finally recovered.
numberOfInstances
in interface IDataset
DatasetException
- if a source access error occurspublic abstract void reset() throws DatasetException
Reset dataset
reset
in interface IDataset
DatasetException
- if a source access error occurspublic abstract boolean next() throws DatasetException
Return the next instance
next
in interface IDataset
DatasetException
- if a source access error occurspublic abstract boolean move(int index) throws DatasetException
Move cursor to index position
move
in interface IDataset
index
- New cursor positionDatasetException
- if a source access error occurspublic IDataset.IInstance read(int rowNumber) throws DatasetException
Reads instance at specified row number
read
in interface IDataset
rowNumber
- the row numberDatasetException
- if an error occurspublic int read(IDataset.IInstance[] buffer) throws DatasetException
Reads some number of instances from the dataset and stores them into a buffer array. The number of instances actually read is returned as an integer
read
in interface IDataset
buffer
- the buffer into which the data is read-1
is there is no more data because
the end of the stream has been reachedDatasetException
- if an error occurspublic int read(IDataset.IInstance[] b, int off, int len) throws DatasetException
Returns cursor instance
read
in interface IDataset
b
- Instances stored when they are read.off
- offset in the vector b.len
- total number of instances to read.DatasetException
- if a source access error occurs