Class SlidingTimeWindow

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, org.drools.base.rule.Behavior, org.drools.base.rule.RuleComponent, BehaviorRuntime

    public class SlidingTimeWindow
    extends java.lang.Object
    implements java.io.Externalizable, BehaviorRuntime
    See Also:
    Serialized Form
    • Field Detail

      • size

        protected long size
      • nodeId

        protected int nodeId
    • Constructor Detail

      • SlidingTimeWindow

        public SlidingTimeWindow()
      • SlidingTimeWindow

        public SlidingTimeWindow​(long size)
    • Method Detail

      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • getType

        public org.drools.base.rule.Behavior.BehaviorType getType()
        Description copied from interface: BehaviorRuntime
        Returns the type of the behavior
        Specified by:
        getType in interface org.drools.base.rule.Behavior
        Specified by:
        getType in interface BehaviorRuntime
      • setWindowNode

        public void setWindowNode​(WindowNode windowNode)
      • getSize

        public long getSize()
        Returns:
        the size
      • setSize

        public void setSize​(long size)
        Parameters:
        size - the size to set
      • assertFact

        public boolean assertFact​(java.lang.Object context,
                                  org.kie.api.runtime.rule.FactHandle fact,
                                  PropagationContext pctx,
                                  ReteEvaluator reteEvaluator)
        Description copied from interface: BehaviorRuntime
        Makes the behavior aware of the new fact entering behavior's scope
        Specified by:
        assertFact in interface BehaviorRuntime
        Parameters:
        context - The behavior context object
        fact - The new fact entering behavior's scope
        Returns:
        true if the propagation should continue, false otherwise. I.e., the behaviour has veto power over the fact propagation, and prevents the propagation to continue if returns false on this method.
      • retractFact

        public void retractFact​(java.lang.Object context,
                                org.kie.api.runtime.rule.FactHandle fact,
                                PropagationContext pctx,
                                ReteEvaluator reteEvaluator)
        Description copied from interface: BehaviorRuntime
        Removes a right tuple from the behavior's scope
        Specified by:
        retractFact in interface BehaviorRuntime
        Parameters:
        context - The behavior context object
        fact - The fact leaving the behavior's scope
      • isExpired

        protected boolean isExpired​(long currentTime,
                                    DefaultEventHandle handle)
      • getExpirationOffset

        public long getExpirationOffset()
        Description copied from interface: BehaviorRuntime
        Some behaviors might change the expiration offset for the associated fact type. Example: time sliding windows. For these behaviors, this method must return the expiration offset associated to them.
        Specified by:
        getExpirationOffset in interface org.drools.base.rule.Behavior
        Specified by:
        getExpirationOffset in interface BehaviorRuntime
        Returns:
        the expiration offset for this behavior or -1 if they don't have a time based expiration offset.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object