Package org.drools.core.common

Examples of org.drools.core.common.BetaConstraints


                                   RightTupleSets srcRightTuples,
                                   LeftTupleSets trgLeftTuples) {
            LeftTupleMemory ltm = bm.getLeftTupleMemory();
            RightTupleMemory rtm = bm.getRightTupleMemory();
            ContextEntry[] contextEntry = bm.getContext();
            BetaConstraints constraints = joinNode.getRawConstraints();

            for (RightTuple rightTuple = srcRightTuples.getInsertFirst(); rightTuple != null; ) {
                RightTuple next = rightTuple.getStagedNext();

                rtm.add(rightTuple);

                FastIterator it = joinNode.getLeftIterator(ltm);
                PropagationContext context = rightTuple.getPropagationContext();

                constraints.updateFromFactHandle(contextEntry,
                                                 wm,
                                                 rightTuple.getFactHandle());

                for (LeftTuple leftTuple = joinNode.getFirstLeftTuple(rightTuple, ltm, context, it); leftTuple != null; leftTuple = (LeftTuple) it.next(leftTuple)) {
                    if (leftTuple.getStagedType() == LeftTuple.UPDATE) {
                        // ignore, as it will get processed via left iteration. Children cannot be processed twice
                        continue;
                    }

                    if (constraints.isAllowedCachedRight(contextEntry,
                                                         leftTuple)) {
                        trgLeftTuples.addInsert(sink.createLeftTuple(leftTuple,
                                                                     rightTuple,
                                                                     null,
                                                                     null,
                                                                     sink,
                                                                     true));
                    }
                }
                rightTuple.clearStaged();
                rightTuple = next;
            }
            constraints.resetFactHandle(contextEntry);
        }
View Full Code Here


                                  LeftTupleSets srcLeftTuples,
                                  LeftTupleSets trgLeftTuples,
                                  LeftTupleSets stagedLeftTuples) {
            RightTupleMemory rtm = bm.getRightTupleMemory();
            ContextEntry[] contextEntry = bm.getContext();
            BetaConstraints constraints = joinNode.getRawConstraints();

            for (LeftTuple leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) {
                LeftTuple next = leftTuple.getStagedNext();

                PropagationContext context = leftTuple.getPropagationContext();

                constraints.updateFromTuple(contextEntry,
                                            wm,
                                            leftTuple);

                FastIterator it = joinNode.getRightIterator(rtm);
                RightTuple rightTuple = joinNode.getFirstRightTuple(leftTuple,
                                                                    rtm,
                                                                    null,
                                                                    it);

                LeftTuple childLeftTuple = leftTuple.getFirstChild();

                // first check our index (for indexed nodes only) hasn't changed and we are returning the same bucket
                // if rightTuple is null, we assume there was a bucket change and that bucket is empty       
                if (childLeftTuple != null && rtm.isIndexed() && !it.isFullIterator() && (rightTuple == null || (rightTuple.getMemory() != childLeftTuple.getRightParent().getMemory()))) {
                    // our index has changed, so delete all the previous propagations
                    while (childLeftTuple != null) {
                        childLeftTuple = deleteLeftChild(childLeftTuple, trgLeftTuples, stagedLeftTuples);
                    }
                    // childLeftTuple is now null, so the next check will attempt matches for new bucket
                }

                // we can't do anything if RightTupleMemory is empty
                if (rightTuple != null) {
                    doLeftUpdatesProcessChildren(childLeftTuple, leftTuple, rightTuple, stagedLeftTuples, contextEntry, constraints, sink, it, trgLeftTuples);
                }
                leftTuple.clearStaged();
                leftTuple = next;
            }
            constraints.resetTuple(contextEntry);
        }
View Full Code Here

                                   RightTupleSets srcRightTuples,
                                   LeftTupleSets trgLeftTuples,
                                   LeftTupleSets stagedLeftTuples) {
            LeftTupleMemory ltm = bm.getLeftTupleMemory();
            ContextEntry[] contextEntry = bm.getContext();
            BetaConstraints constraints = joinNode.getRawConstraints();

            for (RightTuple rightTuple = srcRightTuples.getUpdateFirst(); rightTuple != null; ) {
                RightTuple next = rightTuple.getStagedNext();

                PropagationContext context = rightTuple.getPropagationContext();

                LeftTuple childLeftTuple = rightTuple.getFirstChild();

                FastIterator it = joinNode.getLeftIterator(ltm);
                LeftTuple leftTuple = joinNode.getFirstLeftTuple(rightTuple, ltm, context, it);

                constraints.updateFromFactHandle(contextEntry,
                                                 wm,
                                                 rightTuple.getFactHandle());

                // first check our index (for indexed nodes only) hasn't changed and we are returning the same bucket
                // We assume a bucket change if leftTuple == null       
                if (childLeftTuple != null && ltm.isIndexed() && !it.isFullIterator() && (leftTuple == null || (leftTuple.getMemory() != childLeftTuple.getLeftParent().getMemory()))) {
                    // our index has changed, so delete all the previous propagations
                    while (childLeftTuple != null) {
                        childLeftTuple = deleteRightChild(childLeftTuple, trgLeftTuples, stagedLeftTuples);
                    }
                    // childLeftTuple is now null, so the next check will attempt matches for new bucket                   
                }

                // we can't do anything if LeftTupleMemory is empty
                if (leftTuple != null) {
                    doRightUpdatesProcessChildren(childLeftTuple, leftTuple, rightTuple, stagedLeftTuples, contextEntry, constraints, sink, it, trgLeftTuples);
                }
                rightTuple.clearStaged();
                rightTuple = next;
            }
            constraints.resetFactHandle(contextEntry);
        }
View Full Code Here

        ReteTesterHelper reteTesterHelper = new ReteTesterHelper();

        Pattern pattern = new Pattern(0, new ClassObjectType(leftType));

        //BetaNodeFieldConstraint betaConstraint = null;
        BetaConstraints betaConstraints = null;
        if (constraintFieldName != null) {
            ClassFieldAccessorStore store = (ClassFieldAccessorStore) reteTesterHelper.getStore();

            InternalReadAccessor extractor = store.getReader(leftType,
                                                             leftFieldName,
View Full Code Here

        ReteTesterHelper reteTesterHelper = new ReteTesterHelper();

        Pattern pattern = new Pattern(0, new ClassObjectType(leftType));

        //BetaNodeFieldConstraint betaConstraint = null;
        BetaConstraints betaConstraints = null;
        if (constraintFieldName != null) {
            ClassFieldAccessorStore store = (ClassFieldAccessorStore) reteTesterHelper.getStore();

            InternalReadAccessor extractor = store.getReader(leftType,
                                                             leftFieldName,
View Full Code Here

                } catch ( IntrospectionException e ) {
                    throw new IllegalArgumentException();
                }
            }
           
            BetaConstraints constraints;
            switch ( list.size() ) {
                case 0:
                    constraints = new EmptyBetaConstraints();
                    break;
                case 1:
View Full Code Here

                                                            e );
                    }
                }
            }
           
            BetaConstraints betaSourceConstraints;
            switch ( list.size() ) {
                case 0:
                    betaSourceConstraints = new EmptyBetaConstraints();
                    break;
                case 1:
View Full Code Here

                } catch ( IntrospectionException e ) {
                    throw new IllegalArgumentException();
                }
            }
           
            BetaConstraints constraints;
            switch ( list.size() ) {
                case 0:
                    constraints = new EmptyBetaConstraints();
                    break;
                case 1:
View Full Code Here

                } catch ( IntrospectionException e ) {
                    throw new IllegalArgumentException();
                }
            }
           
            BetaConstraints constraints;
            switch ( list.size() ) {
                case 0:
                    constraints = new EmptyBetaConstraints();
                    break;
                case 1:
View Full Code Here

        MvelConstraint variableConstraint = new MvelConstraintTestUtil("price == age", declaration, priceExtractor);

        final RuleBaseConfiguration configuration = new RuleBaseConfiguration();
        configuration.setIndexRightBetaMemory( false );
        configuration.setIndexLeftBetaMemory( false );
        final BetaConstraints betaConstraints = new SingleBetaConstraints( variableConstraint,
                                                                           configuration );

        final List list = new ArrayList();
        final Cheese cheese1 = new Cheese( "cheddar",
                                           18 );
View Full Code Here

TOP

Related Classes of org.drools.core.common.BetaConstraints

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.