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

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 #12345678
Value123212108
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.
  • 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.OutputPullable

    Nested classes/interfaces inherited from class ca.uqac.lif.cep.Processor

    ca.uqac.lif.cep.Processor.InternalProcessorState
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    The value of the last plateau found.
    protected boolean
    Whether an output event has been sent for the current plateau
    protected float
    The range all values should lie in
    protected boolean
    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_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a plateau finder with default settings
    PlateauFinder(int width)
    Instantiates a plateau finder with default settings
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    compute(Object[] inputs, Queue<Object[]> outputs)
     
     
    duplicate(boolean with_state)
     
    void
     
    setPlateauRange(int range)
    Sets the range all values should lie in to be considered in the same plateau
    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

    Methods 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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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:
  • 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

      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 class WindowProcessor
    • 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(Object[] inputs, Queue<Object[]> outputs)
      Specified by:
      compute in class ca.uqac.lif.cep.SynchronousProcessor
    • computeOutputValue

      public Float computeOutputValue()
      Specified by:
      computeOutputValue in class WindowProcessor
    • duplicate

      public PlateauFinder duplicate(boolean with_state)
      Specified by:
      duplicate in interface ca.uqac.lif.cep.Duplicable
      Specified by:
      duplicate in class ca.uqac.lif.cep.Processor