Class ElementTriggers.CountElement<W extends Window>

    • Method Detail

      • open

        public void open​(Trigger.TriggerContext ctx)
                  throws Exception
        Description copied from class: Trigger
        Initialization method for the trigger. Creates states in this method.
        Specified by:
        open in class Trigger<W extends Window>
        Parameters:
        ctx - A context object that can be used to get states.
        Throws:
        Exception
      • onElement

        public boolean onElement​(Object element,
                                 long timestamp,
                                 W window)
                          throws Exception
        Description copied from class: Trigger
        Called for every element that gets added to a pane. The result of this will determine whether the pane is evaluated to emit results.
        Specified by:
        onElement in class Trigger<W extends Window>
        Parameters:
        element - The element that arrived.
        timestamp - The timestamp of the element that arrived.
        window - The window to which the element is being added.
        Returns:
        true for firing the window, false for no action
        Throws:
        Exception
      • onProcessingTime

        public boolean onProcessingTime​(long time,
                                        W window)
                                 throws Exception
        Description copied from class: Trigger
        Called when a processing-time timer that was set using the trigger context fires.

        Note: This method is not called in case the window does not contain any elements. Thus, if you return PURGE from a trigger method and you expect to do cleanup in a future invocation of a timer callback it might be wise to clean any state that you would clean in the timer callback.

        Specified by:
        onProcessingTime in class Trigger<W extends Window>
        Parameters:
        time - The timestamp at which the timer fired.
        window - The window for which the timer fired.
        Returns:
        true for firing the window, false for no action
        Throws:
        Exception
      • onEventTime

        public boolean onEventTime​(long time,
                                   W window)
                            throws Exception
        Description copied from class: Trigger
        Called when an event-time timer that was set using the trigger context fires.

        Note: This method is not called in case the window does not contain any elements. Thus, if you return PURGE from a trigger method and you expect to do cleanup in a future invocation of a timer callback it might be wise to clean any state that you would clean in the timer callback.

        Specified by:
        onEventTime in class Trigger<W extends Window>
        Parameters:
        time - The timestamp at which the timer fired.
        window - The window for which the timer fired.
        Returns:
        true for firing the window, false for no action
        Throws:
        Exception
      • onMerge

        public void onMerge​(W window,
                            Trigger.OnMergeContext mergeContext)
                     throws Exception
        Description copied from class: Trigger
        Called when several windows have been merged into one window by the WindowAssigner.
        Overrides:
        onMerge in class Trigger<W extends Window>
        Parameters:
        window - The new window that results from the merge.
        Throws:
        Exception