Package org.drools.reteoo

Examples of org.drools.reteoo.AlphaNode$AlphaMemory


        for ( final Iterator<Constraint> it = alphaConstraints.iterator(); it.hasNext(); ) {
            final AlphaNodeFieldConstraint constraint = (AlphaNodeFieldConstraint) it.next();

            context.setObjectSource( (ObjectSource) utils.attachNode( context,
                                                                      new AlphaNode( context.getNextId(),
                                                                                     (AlphaNodeFieldConstraint) constraint,
                                                                                     context.getObjectSource(),
                                                                                     context ) ) );
        }


        for ( final Iterator<Constraint> it = alphaConstraints.iterator(); it.hasNext(); ) {
            final AlphaNodeFieldConstraint constraint = (AlphaNodeFieldConstraint) it.next();

            context.setObjectSource( (ObjectSource) utils.attachNode( context,
                                                                      new AlphaNode( context.getNextId(),
                                                                                     (AlphaNodeFieldConstraint) constraint,
                                                                                     context.getObjectSource(),
                                                                                     context ) ) );
        }

        for ( final Iterator it = alphaConstraints.iterator(); it.hasNext(); ) {
            final AlphaNodeFieldConstraint constraint = (AlphaNodeFieldConstraint) it.next();

            context.setObjectSource( (ObjectSource) utils.attachNode( context,
                                                                      new AlphaNode( context.getNextId(),
                                                                                     (AlphaNodeFieldConstraint) constraint,
                                                                                     context.getObjectSource(),
                                                                                     context ) ) );
        }
       

        for ( final Iterator<Constraint> it = alphaConstraints.iterator(); it.hasNext(); ) {
            final AlphaNodeFieldConstraint constraint = (AlphaNodeFieldConstraint) it.next();

            context.pushRuleComponent( constraint );
            context.setObjectSource( (ObjectSource) utils.attachNode( context,
                                                                      new AlphaNode( context.getNextId(),
                                                                                     (AlphaNodeFieldConstraint) constraint,
                                                                                     context.getObjectSource(),
                                                                                     context ) ) );
            context.popRuleComponent();
        }

                node = n;
                break;
            }
        }
       
        AlphaNode alphanode = (AlphaNode) node.getSinkPropagator().getSinks()[0];
        PredicateConstraint c = ( PredicateConstraint ) alphanode.getConstraint();
        assertTrue( c.getPredicateExpression() instanceof PredicateExpression );
        assertTrue( c.getPredicateExpression() instanceof CompiledInvoker );
        assertTrue( !(c.getPredicateExpression() instanceof MVELPredicateExpression ) );
       
        alphanode = (AlphaNode) alphanode.getSinkPropagator().getSinks()[0];
        FieldValue fieldVal = (( LiteralConstraint ) alphanode.getConstraint()).getField();
       
        assertEquals( "xxx", fieldVal.getValue() );
    }

                node = n;
                break;
            }
        }
       
        AlphaNode alphanode = (AlphaNode) node.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof ClassFieldReader );
        FieldValue r = (( LiteralConstraint ) alphanode.getConstraint()).getField();
       
        assertEquals( p.getAddress(), r.getValue() );
    }        

                node = n;
                break;
            }
        }
       
        AlphaNode alphanode = (AlphaNode) node.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof MVELClassFieldReader );
        assertEquals( new Address("s1"), (( LiteralConstraint ) alphanode.getConstraint()).getField().getValue() );
       
        alphanode = (AlphaNode) alphanode.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof MVELClassFieldReader );
        assertEquals( new Address("s1").getStreet(), (( LiteralConstraint ) alphanode.getConstraint()).getField().getValue() );
    }   

                node = n;
                break;
            }
        }
       
        AlphaNode alphanode = (AlphaNode) node.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof MVELClassFieldReader );
        assertEquals( new Address("s1"), (( LiteralConstraint ) alphanode.getConstraint()).getField().getValue() );
       
        alphanode = (AlphaNode) alphanode.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof MVELClassFieldReader );
        assertEquals( new Address("s1").getStreet(), (( LiteralConstraint ) alphanode.getConstraint()).getField().getValue() );
    }      

                node = n;
                break;
            }
        }
       
        AlphaNode alphanode = (AlphaNode) node.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof MVELClassFieldReader );
        assertEquals( new Address("s1"), (( LiteralConstraint ) alphanode.getConstraint()).getField().getValue() );
       
        alphanode = (AlphaNode) alphanode.getSinkPropagator().getSinks()[0];       
        assertTrue( (( LiteralConstraint ) alphanode.getConstraint()).getFieldExtractor() instanceof MVELClassFieldReader );
        assertEquals( new Address("s1").getStreet(), (( LiteralConstraint ) alphanode.getConstraint()).getField().getValue() );
    }    

        for ( final Iterator<Constraint> it = alphaConstraints.iterator(); it.hasNext(); ) {
            final AlphaNodeFieldConstraint constraint = (AlphaNodeFieldConstraint) it.next();

            context.pushRuleComponent( constraint );
            context.setObjectSource( (ObjectSource) utils.attachNode( context,
                                                                      new AlphaNode( context.getNextId(),
                                                                                     (AlphaNodeFieldConstraint) constraint,
                                                                                     context.getObjectSource(),
                                                                                     context ) ) );
            context.popRuleComponent();
        }

TOP

Related Classes of org.drools.reteoo.AlphaNode$AlphaMemory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.