|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.udo.cs.yale.example.AbstractExampleTable
edu.udo.cs.yale.example.DatabaseExampleTable
public class DatabaseExampleTable
This class is another data supplier for example sets. For performance reasons
one should use a MemoryExampleTable if the data is small enough for
the main memory. Additionally, directly working on databases is highly experimental and
therefore usually not recommended.
| Field Summary | |
|---|---|
private DatabaseHandler |
databaseHandler
|
private java.sql.ResultSet |
resultSet
|
private int |
size
|
private java.lang.String |
tableName
|
| Constructor Summary | |
|---|---|
private |
DatabaseExampleTable(java.sql.ResultSet resultSet,
java.util.List<Attribute> attributes,
DatabaseHandler databaseHandler,
java.lang.String tableName)
|
| Method Summary | |
|---|---|
int |
addAttribute(Attribute attribute)
Adds the attribute to the list of attributes assigning it a free column index. |
private void |
close()
|
static DatabaseExampleTable |
createDatabaseExampleTable(DatabaseHandler databaseHandler,
java.lang.String tableName)
|
void |
finalize()
|
DataRowReader |
getDataReader()
Returns an Iterator for example data given as DataRow
objects. |
DataRow |
getDataRow(int index)
Returns the data row with the desired row index. |
int |
getSize()
Returns the number of examples. |
void |
removeAttribute(Attribute attribute)
Equivalent to calling removeAttribute(attribute.getTableIndex()). |
private void |
resetResultSet()
|
| Methods inherited from class edu.udo.cs.yale.example.AbstractExampleTable |
|---|
addAttributes, createCompleteExampleSet, createCompleteExampleSet, createCompleteExampleSet, createExampleSet, findAttribute, getAttribute, getAttribute, getAttributeCount, getAttributes, getBlockEndIndex, getHighestBlockNr, getNextFreeBlockNr, getNumberOfAttributes, removeAttribute, toDataString, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.sql.ResultSet resultSet
private DatabaseHandler databaseHandler
private java.lang.String tableName
private int size
| Constructor Detail |
|---|
private DatabaseExampleTable(java.sql.ResultSet resultSet,
java.util.List<Attribute> attributes,
DatabaseHandler databaseHandler,
java.lang.String tableName)
throws java.sql.SQLException
java.sql.SQLException| Method Detail |
|---|
public static DatabaseExampleTable createDatabaseExampleTable(DatabaseHandler databaseHandler,
java.lang.String tableName)
throws java.sql.SQLException
java.sql.SQLException
private void resetResultSet()
throws java.sql.SQLException
java.sql.SQLExceptionpublic DataRowReader getDataReader()
AbstractExampleTableDataRow
objects. This should be used in all cases where iteration is desired.
Since AbstractExampleTable.getDataRow(int) does not ensure to work in an efficient
way the usage of this method is preferred (instead using for-loops).
getDataReader in interface ExampleTablegetDataReader in class AbstractExampleTablepublic DataRow getDataRow(int index)
getDataRow in interface ExampleTablegetDataRow in class AbstractExampleTablepublic int addAttribute(Attribute attribute)
AbstractExampleTable
addAttribute in interface ExampleTableaddAttribute in class AbstractExampleTablepublic void removeAttribute(Attribute attribute)
AbstractExampleTableremoveAttribute(attribute.getTableIndex()).
removeAttribute in interface ExampleTableremoveAttribute in class AbstractExampleTablepublic int getSize()
AbstractExampleTable
getSize in interface ExampleTablegetSize in class AbstractExampleTableprivate void close()
public void finalize()
finalize in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||