Package ca.uqac.lif.cep.complex
Class RangeCep
java.lang.Object
ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.complex.RangeCep
- All Implemented Interfaces:
ca.uqac.lif.cep.Contextualizable,ca.uqac.lif.cep.Duplicable,ca.uqac.lif.cep.DuplicableProcessor
public class RangeCep
extends ca.uqac.lif.cep.SynchronousProcessor
Creates complex events out of a range of simple events. The processor is
parameterized by the following elements:
- A processor πR outputting a stream of Boolean values, called the range processor. This processor signals the range of contiguous events of the input stream that should be taken into account in the construction of the complex event. Its expected behavior is to continually return ⊥ until the first event of the range is observed, then to output ⊤ for each event to be included in the range, and then to resume returning ⊥ forever once the range is over.
- An array of processors π1, … πn called the data processors. Each of these processors is fed the range of events identified by πR, and only those events. The calculation done by the data processors is arbitrary.
- A function f called the complex event function. This function must be of arity n:1; it is called exactly once when the end of the range is reached. Its input arguments are the last event produced by each of the πi on the event range; its output is the complex event created out of those values.
allowRestarts(boolean)). In this case, when a complex event
is produced, πR and all of the πi
are reset to their initial state, which makes it possible for a new
complex event to be produced with the events received from this point on.- Author:
- Sylvain Hallé
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumThe current state of the range, which is updated upon receiving each input event.Nested classes/interfaces inherited from class ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.SynchronousProcessor.InputPushable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullableNested classes/interfaces inherited from class ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.Processor.InternalProcessorState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanA flag that determines if more than one complex event can be produced (default:false).protected final ca.uqac.lif.cep.functions.FunctionThe function that is called when the end of the range is reached, and which is used to create the complex output event.protected booleanA flag that determines if the false event that marks the end of a range should count as the first event of a new range (i.e.protected RangeCep.StateThe current state of the range.protected final ca.uqac.lif.cep.tmf.PushUnit[]An array of push units that evaluate the data processors.protected booleanA flag that determines if the event that determines the end boundary of the range should be included (i.e.protected final ca.uqac.lif.cep.tmf.PushUnitA push unit that evaluates the range processor.Fields inherited from class ca.uqac.lif.cep.SynchronousProcessor
m_inputPushables, m_outputPullables, m_tempQueueFields inherited from class ca.uqac.lif.cep.Processor
m_context, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString -
Constructor Summary
ConstructorsModifierConstructorDescriptionRangeCep(ca.uqac.lif.cep.Processor range_processor, ca.uqac.lif.cep.Processor[] data_processors, ca.uqac.lif.cep.functions.Function ce_function) Creates a new range complex event processor.protectedRangeCep(ca.uqac.lif.cep.tmf.PushUnit range, ca.uqac.lif.cep.tmf.PushUnit[] data, ca.uqac.lif.cep.functions.Function ce_function) Creates a new range complex event processor. -
Method Summary
Modifier and TypeMethodDescriptionallowRestarts(boolean b) Sets whether the processor is allowed to produce multiple successive complex events.protected booleanduplicate(boolean with_state) includesLast(boolean b) Sets whether the event that determines the end boundary of the range should be included (i.e.isContiguous(boolean b) Sets whether the false event that marks the end of a range should count as the first event of a new range (i.e.protected ObjectProduces the complex output event out of the last event output by each data processor.protected voidPushes an event front to all data processors.voidreset()Methods inherited from class ca.uqac.lif.cep.SynchronousProcessor
getPullableOutput, getPushableInputMethods inherited from class ca.uqac.lif.cep.Processor
allNotifiedEndOfTrace, allNull, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getId, getInputArity, getInputQueue, getInputType, getInputTypesFor, getOutputArity, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, or, printState, readState, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stop, stopAll
-
Field Details
-
m_currentState
The current state of the range. -
m_range
protected final ca.uqac.lif.cep.tmf.PushUnit m_rangeA push unit that evaluates the range processor. -
m_dataProcessors
protected final ca.uqac.lif.cep.tmf.PushUnit[] m_dataProcessorsAn array of push units that evaluate the data processors. -
m_complexEventFunction
protected final ca.uqac.lif.cep.functions.Function m_complexEventFunctionThe function that is called when the end of the range is reached, and which is used to create the complex output event. -
m_allowRestarts
protected boolean m_allowRestartsA flag that determines if more than one complex event can be produced (default:false). -
m_includesLast
protected boolean m_includesLastA flag that determines if the event that determines the end boundary of the range should be included (i.e. pushed) a part of the complex event (default:false). -
m_contiguous
protected boolean m_contiguousA flag that determines if the false event that marks the end of a range should count as the first event of a new range (i.e. complex events are contiguous).
-
-
Constructor Details
-
RangeCep
public RangeCep(ca.uqac.lif.cep.Processor range_processor, ca.uqac.lif.cep.Processor[] data_processors, ca.uqac.lif.cep.functions.Function ce_function) Creates a new range complex event processor.- Parameters:
range_processor- The processor used to determine the range of events to include in the complex eventdata_processors- An array of processors evaluated on the range of eventsce_function- The function used to create the complex output event out of the values produced by each data processor
-
RangeCep
protected RangeCep(ca.uqac.lif.cep.tmf.PushUnit range, ca.uqac.lif.cep.tmf.PushUnit[] data, ca.uqac.lif.cep.functions.Function ce_function) Creates a new range complex event processor. This constructor is only called internally byduplicate(boolean).- Parameters:
range- A push unit that evaluates the range processordata- An array of push units that evaluate the data processorsce_function- The function used to create the complex output event out of the values produced by each data processor
-
-
Method Details
-
allowRestarts
Sets whether the processor is allowed to produce multiple successive complex events.- Parameters:
b- Set totrueto allow restarts,falseotherwise- Returns:
- This processor
-
includesLast
Sets whether the event that determines the end boundary of the range should be included (i.e. pushed) a part of the complex event.- Parameters:
b- Set totrueto include this last event,falseotherwise- Returns:
- This processor
-
isContiguous
Sets whether the false event that marks the end of a range should count as the first event of a new range (i.e. complex events are contiguous).- Parameters:
b- Set totrueto make complex events contiguous,falseotherwise- Returns:
- This processor
-
compute
- Specified by:
computein classca.uqac.lif.cep.SynchronousProcessor
-
pushFront
Pushes an event front to all data processors.- Parameters:
inputs- The event front
-
produceComplexEvent
Produces the complex output event out of the last event output by each data processor. This is done by fetching all these events in an array and then calling the complex event function.- Returns:
- The complex output event
-
reset
public void reset()- Overrides:
resetin classca.uqac.lif.cep.Processor
-
duplicate
- Specified by:
duplicatein interfaceca.uqac.lif.cep.Duplicable- Specified by:
duplicatein classca.uqac.lif.cep.Processor
-