/** * Attaches the node into the network. Usually to the parent <code>ObjectSource</code> or <code>TupleSource</code> */ public abstract void attach(BuildContext context);
private TerminalNode addSubRule( final BuildContext context, final GroupElement subrule, final int subruleIndex, final Rule rule ) throws InvalidPatternException { // gets the appropriate builder final ReteooComponentBuilder builder = this.utils.getBuilderFor( subrule ); // checks if an initial-fact is needed if (builder.requiresLeftActivation( this.utils, subrule )) { this.addInitialFactPattern( subrule ); } // builds and attach builder.build( context, this.utils, subrule ); ActivationListenerFactory factory = context.getRuleBase().getConfiguration().getActivationListenerFactory( rule.getActivationListener() ); TerminalNode terminal = factory.createActivationListener( context.getNextId(), context.getTupleSource(), rule, subrule, subruleIndex, context ); BaseNode baseTerminalNode = (BaseNode) terminal; baseTerminalNode.attach( context ); context.addNode( baseTerminalNode ); updatePropagations( baseTerminalNode, context ); return terminal; }