|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.data.VoidData
com.davisor.data.stream.EnumeratorDataStream
EnumeratorDataStream represents a data stream that uses a standard Java enumerator to implement a stream of elements. The elements may or may not be DataValues, and they may or may not be of a mutually equal type. The stream itself has a single type, however.
References to DataValue elements are returned as they are. Elements not of the expected type are converted, first to data objects of the proper type, and then the converted objects are returned. The original objects in the source are not changed.
next(),
IteratorDataStream,
Type| Field Summary | |
protected DataValue |
M_data
Reference to the next data element to be returned. |
protected java.util.Enumeration |
M_enumerator
Underlying stream enumerator. |
protected long |
M_index
Element id counter. |
protected java.lang.Object |
M_metaData
Stream meta data (may be null). |
protected boolean |
M_next
Flag that tells if there still is data in this stream. |
| Fields inherited from class com.davisor.data.VoidData |
M_type |
| Fields inherited from interface com.davisor.data.stream.DataStream |
INITIAL_INDEX |
| Constructor Summary | |
EnumeratorDataStream(java.util.Enumeration enumerator)
Creates a data stream out of an enumerator. |
|
EnumeratorDataStream(java.util.Enumeration enumerator,
Type type)
Creates a data stream out of an enumerator and the given type. |
|
| Method Summary | |
boolean |
close()
Dummy implementation. |
long |
getIndex()
Retrieves the index number of the element returned by the latest next() call. |
boolean |
hasNext()
Tests if the stream still contains data. |
DataValue |
next()
Gets the next data value from the stream. |
| Methods inherited from class com.davisor.data.VoidData |
equals, getDataValue, getType, hashCode, setType, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davisor.data.Data |
getType |
| Field Detail |
protected DataValue M_data
protected java.util.Enumeration M_enumerator
protected long M_index
protected boolean M_next
protected java.lang.Object M_metaData
| Constructor Detail |
public EnumeratorDataStream(java.util.Enumeration enumerator)
throws InvalidDataException
AutoType.
InvalidDataException - if the first element was not a DataValue,
and no suitable type could be created for itEnumeratorDataStream(Enumeration,Type)
public EnumeratorDataStream(java.util.Enumeration enumerator,
Type type)
throws InvalidDataException
InvalidDataException - if the first element is not of the given
type and cannot be converted to a data object of that typeEnumeratorDataStream(Enumeration)| Method Detail |
public boolean close()
close in interface DataStreamDataStream.hasNext()public long getIndex()
next() call. The index represents the position of the
element within this stream. The stream index may or may
not be equal to any other indexes the element itself thinks it
posesses.
The index value is initially -1, indicating no
element. After first next() call, index becomes 0, then
1, and so on. This functionality resembles
java.sql.resultSet#getRow method functionality, but
with the difference that the index counter starts from 0, not 1.
getIndex in interface DataStreampublic boolean hasNext()
hasNext in interface DataStreamtrue if it does.
public DataValue next()
throws InvalidDataException
next in interface DataStreamInvalidDataException - if the stream content does not satisfy
the stream type.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||