* If it is a group element, than a subnetwork must be created
*/
public void build(final BuildContext context,
final BuildUtils utils,
final RuleConditionElement rce) {
final GroupElement not = (GroupElement) rce;
// NOT must save some context info to restore it later
final int currentPatternIndex = context.getCurrentPatternOffset();
final LeftTupleSource tupleSource = context.getTupleSource();
// get child
final RuleConditionElement child = (RuleConditionElement) not.getChildren().get( 0 );
// get builder for child
final ReteooComponentBuilder builder = utils.getBuilderFor( child );
// builds the child
builder.build( context,
utils,
child );
// if it is a subnetwork
if ( context.getObjectSource() == null && context.getTupleSource() != null ) {
// attach right input adapter node to convert tuple source into an object source
context.setObjectSource( (ObjectSource) utils.attachNode( context,
new RightInputAdapterNode( context.getNextId(),
context.getTupleSource(),
context ) ) );
// restore tuple source from before the start of the sub network
context.setTupleSource( tupleSource );
// create a tuple start equals constraint and set it in the context
final TupleStartEqualsConstraint constraint = TupleStartEqualsConstraint.getInstance();
final List<TupleStartEqualsConstraint> predicates = new ArrayList<TupleStartEqualsConstraint>();
predicates.add( constraint );
context.setBetaconstraints( predicates );
}
final BetaConstraints betaConstraints = utils.createBetaNodeConstraint( context,
context.getBetaconstraints(),
false );
Behavior[] behaviors = createBehaviorArray( context );
// then attach the NOT node. It will work both as a simple not node
// or as subnetwork join node as the context was set appropriatelly
// in each case
NotNode node = null;
if( GroupElement.FORALL_NOT.equals( not.getType() ) ) {
node = new ForallNotNode( context.getNextId(),
context.getTupleSource(),
context.getObjectSource(),
betaConstraints,
behaviors,
context,
not.getForallBaseObjectType() );
} else {
node = new NotNode( context.getNextId(),
context.getTupleSource(),
context.getObjectSource(),
betaConstraints,