|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.opmath.util.datastruct.ComparableResultSet
An object which can serve as a ComparableTable column, implemented using a
java.sql.ResultSet.
ComparableResultSet implements the ComparableList interface, thus it provides a storage
structure for columns of a ComparableTable with exactly the access methods required by the
containing class.
This class uses a java.sql.ResultSet as its storage object. The reasons for this are twofold:
java.sql.ResultSet, then ComparableResultSet removes the need to copy this data
field-by-field into the ComparableTable storage structure.
ComparableResultSet allows for a java.sql.ResultSet
to be registered against a ComparableTable within a
doGet(HttpServletRequest, HttpServletResponse) or
doPost(HttpServletRequest, HttpServletResponse). All of the data contained in the result set is
avaliable to the ComparableTable without further coding.
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
| Constructor Summary | |
ComparableResultSet(ResultSet rs,
String columnName)
Constructs a new ComparableResultSet. |
|
ComparableResultSet(ResultSet rs,
String columnName,
int startRowIndex,
int endRowIndex)
Constructs a new ComparableResultSet with limiting row bounds. |
|
| Method Summary | |
boolean |
add(Comparable element)
Always thows an UnsupportedOperationException. |
void |
clear()
Does nothing. |
Enumeration |
elements()
Returns an enumeration of the components of this ComparableResultSet. |
Object |
get(int index)
Returns the element at the specified position in this ComparableResultSet. |
int |
indexOf(Object element)
Returns the position of the first occurance of element. |
Comparable |
set(int index,
Comparable element)
Always thows an UnsupportedOperationException. |
int |
size()
Returns the number of elements in this ComparableResultSet. |
String |
toString()
Returns a string representation of the ComparableResultSet, containing a String
representation of each element. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public ComparableResultSet(ResultSet rs,
String columnName,
int startRowIndex,
int endRowIndex)
ComparableResultSet with limiting row bounds. This
ComparableResultSet will make reference to the column columnName
in the java.sql.ResultSet identified by rs, and will allow
access to the rows startRowIndex to endRowIndex inclusive.
When accessing elements in this ComparableResultSet, the index 0 refers to the first
accessible row in the result set, 1 to the second, and so on.
NOTE 1: The constructor clips startRowIndex and endRowIndex to fit the
result set (and does not report this action); startRowIndex must be less than or equal
to endRowIndex.
NOTE 2: This new ComparableResultSet always treats the java.sql.ResultSet as
being read-only.
NOTE 3: No check is made as to whether columnName identifies a column in the
java.sql.ResultSet - this check should be made elsewhere. If columnName
is not valid, all access attempts will return null.
rs - the java.sql.ResultSet.columnName - the String identifying the column.startRowIndex - the int identifying the first relevant row in the
java.sql.ResultSet (first position is 1).endRowIndex - the int identifying the last relevant row in the
java.sql.ResultSet.
public ComparableResultSet(ResultSet rs,
String columnName)
ComparableResultSet. This ComparableResultSet will make
reference to the column columnName in the java.sql.ResultSet identified
by rs. All rows can be accessed.
When accessing elements in this ComparableResultSet, the index 0 refers to the first
accessible row in the result set, 1 to the second, and so on.
NOTE 1: This new ComparableResultSet always treats the java.sql.ResultSet as
being read-only.
NOTE 2: No check is made as to whether columnName identifies a column in the
java.sql.ResultSet - this check should be made elsewhere. If columnName
is not valid, all access attempts will return null.
rs - the java.sql.ResultSet.columnName - the String identifying the column.| Method Detail |
public Enumeration elements()
ComparableResultSet. The returned
Enumeration object will generate all items in the ComparableResultSet.
elements in interface ComparableListComparableResultSet.Enumerationpublic void clear()
Note that when the containing ComparableTable receives a clear(),
all ComparableResultSet columns are removed.
clear in interface ComparableList
public boolean add(Comparable element)
throws UnsupportedOperationException
UnsupportedOperationException.
NOTE: Although it is declared as returning a boolean, add(Comparable)
never returns anything.
add in interface ComparableListelement - the Comparable to be added.UnsupportedOperationException - always.
public Comparable set(int index,
Comparable element)
throws UnsupportedOperationException
UnsupportedOperationException.
NOTE: Although it is declared as returning a Comparable, set(int, Comparable)
never returns anything.
set in interface ComparableListindex - the int index of element to replace.element - the Comparable element to be stored at the specified position.UnsupportedOperationException - always.
public Object get(int index)
throws ArrayIndexOutOfBoundsException
ComparableResultSet.
get in interface ComparableListindex - the int index of element.ComparableResultSet.ArrayIndexOutOfBoundsException - an exception thrown if the index is out of
range (index < 0 || index >= size()).public int indexOf(Object element)
element.
indexOf in interface ComparableListelement - the Comparable search criterion.int index of the first occurance of element or -1.public int size()
ComparableResultSet. If there were any problems in
initialising this instance, size() returns 0.
size in interface ComparableListpublic String toString()
ComparableResultSet, containing a String
representation of each element.
toString in interface ComparableListtoString in class Object
|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||