0.10.8-alpha
|
Queries events on one of a processor's outputs. More...
Classes | |
enum | NextStatus |
The "next" status of a Pullable object. More... | |
class | PullableException |
A runtime exception indicating that something went wrong when attempting to check if a next event exists. More... | |
class | PullNotSupported |
Pullable object that throws an UnsupportedOperationException upon every call to each of its methods (except getProcessor()). More... | |
Public Member Functions | |
Object | pullSoft () |
Attempts to pull an event from the source. More... | |
Object | pull () |
Attempts to pull an event from the source. More... | |
Object | next () |
Attempts to obtain an event from the source. More... | |
NextStatus | hasNextSoft () |
Determines if an event can be pulled from the output. More... | |
boolean | hasNext () |
Determines if an event can be pulled from the output, by trying "harder" than hasNextSoft(). More... | |
Processor | getProcessor () |
Gets the processor instance this Pullable is linked to. More... | |
int | getPosition () |
Gets the position this Pullable is associated to: 0 is the first input (or output), 1 the second, etc. More... | |
void | start () |
Starts the pullable. More... | |
void | stop () |
Stops the pullable. More... | |
void | dispose () |
Tells this pullable that methods pull(), pullSoft(), hasNext() and hasNextSoft() will not be called anymore. More... | |
Queries events on one of a processor's outputs.
For a processor with an output arity n, there exists n distinct pullables, namely one for each output pipe. Every pullable works roughly like a classical Iterator
: it is possible to check whether new output events are available, and get one new output event.
However, contrarily to iterators, Pullable
s have two versions of each method: a soft and a hard version.
MAYBE
), and pullSoft() will return null
. Soft methods can be seen a doing "one turn of the crank" on the whole chain of processors –whether or not this outputs something. MAYBE
(only YES
or NO
), and pull() throws The lifecycle of a Pullable
object is as follows:
The Pullable interface extends the Iterator
and Iterable
interfaces. This means that an instance of Pullable
can also be iterated over like this:
Pullable p = ...; for (Object o : p) { // Do something }
Note however that if p
refers to a processor producing an infinite number of events, this loop will never terminate by itself.
For the same processor, mixing calls to soft and hard methods is discouraged. As a matter of fact, the Pullable
's behaviour in such a situation is left undefined.
Definition at line 85 of file Pullable.java.
void ca.uqac.lif.cep.Pullable.dispose | ( | ) |
Tells this pullable that methods pull(), pullSoft(), hasNext() and hasNextSoft() will not be called anymore.
For some types of pullables, this can be used as a cue to free some resources (such as threads). The behaviour of these four methods after dispose()
has been called is undefined. In future versions, it is possible that an exception will be thrown in such a case.
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
int ca.uqac.lif.cep.Pullable.getPosition | ( | ) |
Gets the position this Pullable is associated to: 0 is the first input (or output), 1 the second, etc.
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
Processor ca.uqac.lif.cep.Pullable.getProcessor | ( | ) |
Gets the processor instance this Pullable is linked to.
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
boolean ca.uqac.lif.cep.Pullable.hasNext | ( | ) |
Determines if an event can be pulled from the output, by trying "harder" than hasNextSoft().
Depending on what happens, the possible return values are:
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
NextStatus ca.uqac.lif.cep.Pullable.hasNextSoft | ( | ) |
Determines if an event can be pulled from the output.
Depending on what happens, the possible return values are:
Therefore, the method is lazy in that it asks events from its input only once, and attempts to produce an output event only once.
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
Object ca.uqac.lif.cep.Pullable.next | ( | ) |
Attempts to obtain an event from the source.
An event is returned if hasNext() returns YES
, and java.util.NoSuchElementException
is thrown otherwise.
java.util.NoSuchElementException | if the iteration has no more elements |
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
Object ca.uqac.lif.cep.Pullable.pull | ( | ) |
Attempts to pull an event from the source.
An event is returned if hasNext() returns YES
, and java.util.NoSuchElementException
is thrown otherwise.
java.util.NoSuchElementException | if the iteration has no more elements |
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
Object ca.uqac.lif.cep.Pullable.pullSoft | ( | ) |
Attempts to pull an event from the source.
An event is returned if hasNextSoft() returns YES
, and null
is returned otherwise.
null
if none could be retrieved Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Multiplex.MuxPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, and ca.uqac.lif.cep.TypedPullable< T >.
void ca.uqac.lif.cep.Pullable.start | ( | ) |
Starts the pullable.
This may be useful for multi-threaded pullables.
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, ca.uqac.lif.cep.TypedPullable< T >, and ca.uqac.lif.cep.tmf.Multiplex.MuxPullable.
void ca.uqac.lif.cep.Pullable.stop | ( | ) |
Stops the pullable.
This may be useful for multi-threaded pullables.
Implemented in ca.uqac.lif.cep.GroupProcessor.ProxyPullable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable, ca.uqac.lif.cep.UniformProcessor.UnaryPullable, ca.uqac.lif.cep.Pullable.PullNotSupported, ca.uqac.lif.cep.functions.ApplyFunctionPartial.OutputPullable, ca.uqac.lif.cep.tmf.Divert.DivertPullable, ca.uqac.lif.cep.AsynchronousProcessor.OutputPullable, ca.uqac.lif.cep.tmf.Tank.QueuePullable, ca.uqac.lif.cep.TypedPullable< T >, and ca.uqac.lif.cep.tmf.Multiplex.MuxPullable.