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.azrael.Printable
,ca.uqac.lif.azrael.Readable
,ca.uqac.lif.cep.Contextualizable
,ca.uqac.lif.cep.Duplicable
,ca.uqac.lif.cep.DuplicableProcessor
public class PlateauFinder extends WindowProcessor
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.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
-
-
Field Summary
Fields Modifier and Type Field Description protected double
m_lastPlateauFound
The value of the last plateau found.protected boolean
m_plateauFound
Whether an output event has been sent for the current plateauprotected float
m_range
The range all values should lie inprotected boolean
m_relative
Whether 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_precision
-
Fields inherited from class ca.uqac.lif.cep.SynchronousProcessor
m_inputPushables, m_outputPullables, m_tempQueue
-
Fields inherited from class ca.uqac.lif.cep.Processor
m_context, m_eventTracker, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputCount, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputCount, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString
-
-
Constructor Summary
Constructors Constructor Description PlateauFinder()
Instantiates a plateau finder with default settingsPlateauFinder(int width)
Instantiates a plateau finder with default settings
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
compute(java.lang.Object[] inputs, java.util.Queue<java.lang.Object[]> outputs)
java.lang.Float
computeOutputValue()
PlateauFinder
duplicate(boolean with_state)
void
reset()
PlateauFinder
setPlateauRange(int range)
Sets the range all values should lie in to be considered in the same plateauPlateauFinder
setRelative(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, getMinValue
-
Methods inherited from class ca.uqac.lif.cep.SynchronousProcessor
getPullableOutput, getPushableInput, setEventTracker
-
Methods inherited from class ca.uqac.lif.cep.Processor
allNotifiedEndOfTrace, allNull, associateTo, associateToInput, associateToOutput, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getEventTracker, getId, getInputArity, getInputCount, getInputQueue, getInputType, getInputTypesFor, getLeaves, getLeaves, getOutputArity, getOutputCount, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, print, printState, read, readState, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stop, stopAll
-
-
-
-
Field Detail
-
m_range
protected float m_range
The range all values should lie in
-
m_plateauFound
protected boolean m_plateauFound
Whether an output event has been sent for the current plateau
-
m_relative
protected boolean m_relative
Whether the height of the plateau should be relative to that of the last plateau (true
), or absolute (false
)
-
m_lastPlateauFound
protected double m_lastPlateauFound
The value of the last plateau found. Remembering this value is necessary if the finder is set to "relative" mode- See Also:
setRelative(boolean)
-
-
Method Detail
-
setRelative
public PlateauFinder setRelative(boolean relative)
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:
reset
in classWindowProcessor
-
setPlateauRange
public PlateauFinder setPlateauRange(int range)
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
protected boolean compute(java.lang.Object[] inputs, java.util.Queue<java.lang.Object[]> outputs)
- Specified by:
compute
in classca.uqac.lif.cep.SynchronousProcessor
-
computeOutputValue
public java.lang.Float computeOutputValue()
- Specified by:
computeOutputValue
in classWindowProcessor
-
duplicate
public PlateauFinder duplicate(boolean with_state)
- Specified by:
duplicate
in interfaceca.uqac.lif.cep.Duplicable
- Specified by:
duplicate
in classca.uqac.lif.cep.Processor
-
-