com.davisor.data.stream
Class ListIteratorDataStream
java.lang.Object
com.davisor.data.VoidData
com.davisor.data.stream.IteratorDataStream
com.davisor.data.stream.ListIteratorDataStream
- All Implemented Interfaces:
- Data, DataStream
- public class ListIteratorDataStream
- extends IteratorDataStream
ListIteratorDataStream represents a data stream that uses a
standard Java list iterator to implement stream elements. In
particular, the target list may be iterated forward or
backward. 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.
- Since:
- JDK1.1
- See Also:
next(),
EnumeratorDataStream,
Type
|
Constructor Summary |
ListIteratorDataStream(java.util.List list,
boolean reversed)
Creates a data stream out of a list. |
ListIteratorDataStream(java.util.ListIterator iterator,
boolean reversed)
Creates a data stream out of an iterator. |
ListIteratorDataStream(java.util.ListIterator iterator,
Type type,
boolean reversed)
Creates a data stream out of an iterator and the given type. |
ListIteratorDataStream(java.util.List list,
Type type,
boolean reversed)
Creates a data stream out of a list and given type. |
|
Method Summary |
DataValue |
next()
Gets the next data value from the stream. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davisor.data.Data |
getType |
M_reversed
protected boolean M_reversed
ListIteratorDataStream
public ListIteratorDataStream(java.util.List list,
boolean reversed)
throws InvalidDataException
- Creates a data stream out of a list. The data stream type
is taken from the first element in the list.
- Parameters:
list - data list to create a stream fromreversed - controls if stream reads list forwards or backwards
- Throws:
InvalidDataException - if the first element is not a DataValue
ListIteratorDataStream
public ListIteratorDataStream(java.util.List list,
Type type,
boolean reversed)
throws InvalidDataException
- Creates a data stream out of a list and given type.
- Parameters:
list - data collection to create a stream fromtype - the type of data in streamreversed - controls if stream reads list forwards or backwards
- Throws:
InvalidDataException - if the first element is not of the given
type, and cannot be converted to a data object of that type
ListIteratorDataStream
public ListIteratorDataStream(java.util.ListIterator iterator,
boolean reversed)
throws InvalidDataException
- Creates a data stream out of an iterator. The data stream type
is set to
AutoType.
- Parameters:
iterator - data iterator to create a stream fromreversed - controls if stream reads list forwards or backwards
- Throws:
InvalidDataException - if the first element was not a DataValue,
and no suitable type could be created for it
ListIteratorDataStream
public ListIteratorDataStream(java.util.ListIterator iterator,
Type type,
boolean reversed)
throws InvalidDataException
- Creates a data stream out of an iterator and the given type.
- Parameters:
iterator - data iterator to create a stream fromtype - the type of data in streamreversed - controls if stream reads list forwards or backwards
- Throws:
InvalidDataException - if the first element is not of the given
type, and cannot be converted to a data object of that type
next
public DataValue next()
throws InvalidDataException
- Gets the next data value from the stream.
- Specified by:
next in interface DataStream- Overrides:
next in class IteratorDataStream
- Throws:
InvalidDataException - if the stream content does not satisfy
the stream type.- See Also:
IteratorDataStream.close(),
VoidData.getDataValue(java.lang.Object),
IteratorDataStream.hasNext(),
IteratorDataStream.init(java.util.Iterator)
Copyright © 2001-2004 Davisor Oy. All Rights Reserved.