Package org.drools.core.reteoo

Examples of org.drools.core.reteoo.RightTuple


        return compResult < 0 || (compResult == 0 && descendingConstraintType == ConstraintType.LESS_OR_EQUAL) ? rightTuple : null;
    }

    public Iterator iterator() {
        RightTupleList list = tree.first().value;
        RightTuple firstTuple = list != null ? list.first : null;
        return new FastIterator.IteratorAdapter(fastIterator(), firstTuple);
    }
View Full Code Here


        public Entry next(Entry object) {
            if (object == null) {
                return null;
            }
            RightTuple rightTuple = (RightTuple) object;
            RightTuple next = (RightTuple) rightTuple.getNext();
            if (next != null) {
                return next;
            }
            Comparable key = getRightIndexedValue(rightTuple);
            next = getNext(key, false);
View Full Code Here

                           this.table.length );
            row++; // row always points to the row after the current list
        }

        public Entry next(Entry object) {
            RightTuple rightTuple = ( RightTuple ) object;
            RightTupleList list = null;
            if ( rightTuple != null ) {
                list = rightTuple.getMemory(); // assumes you do not pass in a null RightTuple
            }

            int length = table.length;

            while ( this.row <= length ) {
                // check if there is a current bucket
                while ( list == null ) {                   
                    if ( this.row < length ) {
                        // iterate while there is no current bucket, trying each array position
                        list = (RightTupleList) this.table[this.row];
                        this.row++;                  
                    } else {    
                        // we've scanned the whole table and nothing is left, so return null
                        return null;
                    }
                   
                    if ( list != null ) {
                        // we have a bucket so assign the frist LeftTuple and return
                        rightTuple = (RightTuple) list.getFirst( );
                        return rightTuple;
                    }               
                }

                rightTuple = (RightTuple) rightTuple.getNext();
                if ( rightTuple != null ) {
                    // we have a next tuple so return
                    return rightTuple;
                } else {
                    list = (RightTupleList) list.getNext();
View Full Code Here

                final Object object = it.next();
                if ( (object == null) || !resultClass.isAssignableFrom( object.getClass() ) ) {
                    continue; // skip anything if it not assignable
                }

                RightTuple rightTuple = fromNode.createRightTuple(leftTuple,
                                                                  propagationContext,
                                                                  wm,
                                                                  object);

                checkConstraintsAndPropagate(sink,
View Full Code Here

                final Object object = it.next();
                if ( (object == null) || !resultClass.isAssignableFrom( object.getClass() ) ) {
                    continue; // skip anything if it not assignable
                }

                RightTuple rightTuple = previousMatches.remove(object);

                if (rightTuple == null) {
                    // new match, propagate assert
                    rightTuple = fromNode.createRightTuple(leftTuple,
                                                           propagationContext,
                                                           wm,
                                                           object);
                } else {
                    // previous match, so reevaluate and propagate modify
                    if (rightIt.next(rightTuple) != null) {
                        // handle the odd case where more than one object has the same hashcode/equals value
                        previousMatches.put(object,
                                            (RightTuple) rightIt.next(rightTuple));
                        rightTuple.setNext(null);
                    }
                }

                checkConstraintsAndPropagate(sink,
                                             leftTuple,
View Full Code Here

    public static void unlinkCreatedHandles(final LeftTuple leftTuple) {
        Map<Object, RightTuple> matches = (Map<Object, RightTuple>) leftTuple.getObject();
        FastIterator rightIt = LinkedList.fastIterator;
        for (RightTuple rightTuple : matches.values()) {
            for (RightTuple current = rightTuple; current != null; ) {
                RightTuple next = (RightTuple) rightIt.next(current);
                current.unlinkFromRightParent();
                current = next;
            }
        }
    }
View Full Code Here

        List<Comparable> toBeRemoved = new ArrayList<Comparable>();
        List<RightTuple> result = new ArrayList<RightTuple>();

        RightTupleList list = null;
        while ( (list = (RightTupleList) it.next( list )) != null ) {
            RightTuple entry = list.getFirst();
            while (entry != null) {
                result.add(entry);
                entry = (RightTuple) entry.getNext();
            }
        }

        return result.toArray(new LeftTuple[result.size()]);
    }
View Full Code Here

        return getNext(key, true);
    }

    public Iterator iterator() {
        RightTupleList list = tree.first();
        RightTuple firstTuple = list != null ? list.first : null;
        return new FastIterator.IteratorAdapter(fastIterator(), firstTuple);
    }
View Full Code Here

        public Entry next(Entry object) {
            if (object == null) {
                Node<Comparable<Comparable>> firstNode = tree.first();
                return firstNode == null ? null : firstNode.getFirst();
            }
            RightTuple rightTuple = (RightTuple) object;
            RightTuple next = (RightTuple) rightTuple.getNext();
            if (next != null) {
                return next;
            }
            Comparable key = getIndexedValue(rightTuple);
            return getNext(key, false);
View Full Code Here

                LeftTuple leftTuple = tupleEntry.getLeftTuple();
                if (leftTuple.getMemory() != null) {
                    leftTuple.getMemory().remove(leftTuple);
                }
            } else {
                RightTuple rightTuple = tupleEntry.getRightTuple();
                if (rightTuple.getMemory() != null) {
                    rightTuple.getMemory().remove(rightTuple);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.core.reteoo.RightTuple

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.