Class RETETerminal

  • All Implemented Interfaces:
    RETENode, RETESinkNode

    public class RETETerminal
    extends java.lang.Object
    implements RETESinkNode
    The final node in a RETE graph. It runs the builtin guard clauses and then, if the token passes, executes the head operations.
    • Constructor Detail

      • RETETerminal

        public RETETerminal​(Rule rule,
                            RETEEngine engine,
                            ForwardRuleInfGraphI graph)
        Constructor.
        Parameters:
        rule - the rule which this terminal should fire.
        engine - the parent rule engine through which the deductions and recursive network can be reached.
        graph - the wider encompassing infGraph needed to for the RuleContext
    • Method Detail

      • setContext

        public void setContext​(RETEEngine engine,
                               ForwardRuleInfGraphI graph)
        Change the engine/graph to which this terminal should deliver its results.
      • fire

        public void fire​(BindingVector env,
                         boolean isAdd)
        Propagate a token to this node.
        Specified by:
        fire in interface RETESinkNode
        Parameters:
        env - a set of variable bindings for the rule being processed.
        isAdd - distinguishes between add and remove operations.
      • clone

        public RETENode clone​(java.util.Map<RETENode,​RETENode> netCopy,
                              RETERuleContext contextIn)
        Clone this node in the network.
        Specified by:
        clone in interface RETENode
        Parameters:
        netCopy - a map from RETENode to cloned instance
        contextIn - the new context to which the network is being ported