Package ca.uqac.lif.cep.signal
Class PlateauFinder
java.lang.Object
ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.signal.WindowProcessor
ca.uqac.lif.cep.signal.PlateauFinder
- All Implemented Interfaces:
ca.uqac.lif.cep.Contextualizable,ca.uqac.lif.cep.Duplicable,ca.uqac.lif.cep.DuplicableProcessor
Finds a plateau in a data stream. A plateau is found when all
values in a window lie in an interval of a predetermined width.
By default, the interval is of width 5 and the window is of width 5.
An output event will be emitted after reading event #5 (there are five
consecutive values all within an interval of 5), indicating that event 1
is the start of a plateau, but a zero event will be
produced for all other events, as they are the continuation of the current
plateau.
The plateau finder outputs a non-zero event only for the first event of the plateau (this has to be delayed by the width of the window). It outputs zero for all other events of the plateau. Moreover, new plateau will only be looked for only once a value lies outside the current interval. For example, in the following sequence:
| Event # | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Value | 1 | 2 | 3 | 2 | 1 | 2 | 10 | 8 |
-
Nested Class Summary
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 doubleThe value of the last plateau found.protected booleanWhether an output event has been sent for the current plateauprotected floatThe range all values should lie inprotected booleanWhether the height of the plateau should be relative to that of the last plateau (true), or absolute (false)Fields inherited from class ca.uqac.lif.cep.signal.WindowProcessor
m_maxValue, m_minValue, m_values, m_windowWidth, s_precisionFields 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
ConstructorsConstructorDescriptionInstantiates a plateau finder with default settingsPlateauFinder(int width) Instantiates a plateau finder with default settings -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanduplicate(boolean with_state) voidreset()setPlateauRange(int range) Sets the range all values should lie in to be considered in the same plateausetRelative(boolean relative) Sets whether the height of the plateau should be relative to that of the last plateau (true), or absolute (false)Methods inherited from class ca.uqac.lif.cep.signal.WindowProcessor
doubleEquals, getMaxValue, getMinValueMethods 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_range
protected float m_rangeThe range all values should lie in -
m_plateauFound
protected boolean m_plateauFoundWhether an output event has been sent for the current plateau -
m_relative
protected boolean m_relativeWhether the height of the plateau should be relative to that of the last plateau (true), or absolute (false) -
m_lastPlateauFound
protected double m_lastPlateauFoundThe value of the last plateau found. Remembering this value is necessary if the finder is set to "relative" mode- See Also:
-
-
Constructor Details
-
PlateauFinder
public PlateauFinder(int width) Instantiates a plateau finder with default settings- Parameters:
width- The width of the window
-
PlateauFinder
public PlateauFinder()Instantiates a plateau finder with default settings
-
-
Method Details
-
setRelative
Sets whether the height of the plateau should be relative to that of the last plateau (true), or absolute (false)- Parameters:
relative- See above- Returns:
- A reference to the current plateau finder
-
reset
public void reset()- Overrides:
resetin classWindowProcessor
-
setPlateauRange
Sets the range all values should lie in to be considered in the same plateau- Parameters:
range- The range- Returns:
- A reference to the current plateau finder
-
compute
- Specified by:
computein classca.uqac.lif.cep.SynchronousProcessor
-
computeOutputValue
- Specified by:
computeOutputValuein classWindowProcessor
-
duplicate
- Specified by:
duplicatein interfaceca.uqac.lif.cep.Duplicable- Specified by:
duplicatein classca.uqac.lif.cep.Processor
-