Interface RuleUnitInstance<T extends RuleUnitData>

  • Type Parameters:
    T - The RuleUnitData for which this rule unit is generated.
    All Superinterfaces:
    java.lang.AutoCloseable

    public interface RuleUnitInstance<T extends RuleUnitData>
    extends java.lang.AutoCloseable
    An instance of a RuleUnit working on the data contained in a specific RuleUnitData.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Releases all resources used by this RuleUnitInstance, setting it up for garbage collection.
      org.kie.api.runtime.rule.QueryResults executeQuery​(java.lang.String query, java.lang.Object... arguments)
      Executes the query with the given name on this instance, using the given set of arguments
      int fire()
      Trigger the pattern matching algorithm on all the facts contained in the DataSources of the RuleUnitData used by this RuleUnitInstance and fires all the rules activated by them.
      int fire​(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
      Trigger the pattern matching algorithm on all the facts contained in the DataSources of the RuleUnitData used by this RuleUnitInstance and fires all the rules activated by them.
      <T extends org.kie.api.time.SessionClock>
      T
      getClock()  
      T ruleUnitData()
      The instance of RuleUnitData containing the data used by this RuleUnitInstance.
      RuleUnit<T> unit()
      The RuleUnit from which this RuleUnitInstance has been created.
    • Method Detail

      • unit

        RuleUnit<T> unit()
        The RuleUnit from which this RuleUnitInstance has been created.
      • ruleUnitData

        T ruleUnitData()
        The instance of RuleUnitData containing the data used by this RuleUnitInstance.
      • fire

        int fire()
        Trigger the pattern matching algorithm on all the facts contained in the DataSources of the RuleUnitData used by this RuleUnitInstance and fires all the rules activated by them.
        Returns:
        The number of fired rules.
      • fire

        int fire​(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
        Trigger the pattern matching algorithm on all the facts contained in the DataSources of the RuleUnitData used by this RuleUnitInstance and fires all the rules activated by them.
        Parameters:
        agendaFilter - filters the Matches that may fire
        Returns:
        The number of fired rules.
      • executeQuery

        org.kie.api.runtime.rule.QueryResults executeQuery​(java.lang.String query,
                                                           java.lang.Object... arguments)
        Executes the query with the given name on this instance, using the given set of arguments
        Parameters:
        query - The name of the query to be executed
        arguments - The arguments to be passed to the query
        Returns:
        query results
      • getClock

        <T extends org.kie.api.time.SessionClock> T getClock()
        Returns:
        the session clock instance used by this RuleUnitInstance
      • close

        void close()
        Releases all resources used by this RuleUnitInstance, setting it up for garbage collection. This method must always be called after finishing using the RuleUnitInstance, or the engine will not free the memory it uses.
        Specified by:
        close in interface java.lang.AutoCloseable