Class SlidingLengthWindow

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, Behavior, RuleComponent

    public class SlidingLengthWindow
    extends java.lang.Object
    implements java.io.Externalizable, Behavior
    A length window behavior implementation
    See Also:
    Serialized Form
    • Field Detail

      • size

        protected int size
    • Constructor Detail

      • SlidingLengthWindow

        public SlidingLengthWindow()
      • SlidingLengthWindow

        public SlidingLengthWindow​(int size)
        Parameters:
        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
      • getSize

        public long getSize()
        Returns:
        the size
      • setSize

        public void setSize​(int size)
        Parameters:
        size - the size to set
      • createContext

        public Behavior.Context createContext()
        Description copied from interface: Behavior
        Creates the context object associated with this behavior. The object is given as a parameter in all behavior call backs.
        Specified by:
        createContext in interface Behavior
      • assertFact

        public boolean assertFact​(java.lang.Object context,
                                  InternalFactHandle handle,
                                  PropagationContext pctx,
                                  ReteEvaluator reteEvaluator)
        Description copied from interface: Behavior
        Makes the behavior aware of the new fact entering behavior's scope
        Specified by:
        assertFact in interface Behavior
        Parameters:
        context - The behavior context object
        handle - The new fact entering behavior's scope
        reteEvaluator - The working memory session reference
        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,
                                InternalFactHandle handle,
                                PropagationContext pctx,
                                ReteEvaluator reteEvaluator)
        Description copied from interface: Behavior
        Removes a right tuple from the behavior's scope
        Specified by:
        retractFact in interface Behavior
        Parameters:
        context - The behavior context object
        handle - The fact leaving the behavior's scope
        reteEvaluator - The working memory session reference
      • getExpirationOffset

        public long getExpirationOffset()
        Length windows don't change expiration offset, so always return -1
        Specified by:
        getExpirationOffset in interface Behavior
        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