// Path: src/java/org/apache/cassandra/db/index/sasi/utils/trie/Cursor.java
// enum Decision
// {
//         
//     /**
//      * Exit the traverse operation
//      */
//     EXIT, 
//         
//     /**
//      * Continue with the traverse operation
//      */
//     CONTINUE, 
//         
//     /**
//      * Remove the previously returned element
//      * from the {@link Trie} and continue
//      */
//     REMOVE, 
//         
//     /**
//      * Remove the previously returned element
//      * from the {@link Trie} and exit from the
//      * traverse operation
//      */
//     REMOVE_AND_EXIT
// }


import java.util.NoSuchElementException;
import java.util.Set;
import org.apache.cassandra.db.index.sasi.utils.trie.Cursor.Decision;
import java.util.AbstractCollection;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Map;

        if (!isBitSet(key, h.bitIndex))
        {
            if (selectR(h.left, h.bitIndex, key, reference))
            {
                return selectR(h.right, h.bitIndex, key, reference);
            }
        }
        else
        {
            if (selectR(h.right, h.bitIndex, key, reference))
            {
                return selectR(h.left, h.bitIndex, key, reference);
            }
        }

        return false;
    }
    
    /**
     * 
     */
    private boolean selectR(TrieEntry<K,V> h, int bitIndex, 
                            final K key, final Cursor<? super K, ? super V> cursor,
                            final Reference<Map.Entry<K, V>> reference)
    {
        if (h.bitIndex <= bitIndex)
        {
            if (!h.isEmpty())
            {
// Path: src/java/org/apache/cassandra/db/index/sasi/utils/trie/Cursor.java
// enum Decision
// {
//         
//     /**
//      * Exit the traverse operation
//      */
//     EXIT, 
//         
//     /**
//      * Continue with the traverse operation
//      */
//     CONTINUE, 
//         
//     /**
//      * Remove the previously returned element
//      * from the {@link Trie} and continue
//      */
//     REMOVE, 
//         
//     /**
//      * Remove the previously returned element
//      * from the {@link Trie} and exit from the
//      * traverse operation
//      */
//     REMOVE_AND_EXIT
// }


// Path: src/java/org/apache/cassandra/db/index/sasi/utils/trie/AbstractPatriciaTrie.java
import java.util.NoSuchElementException;
import java.util.Set;
import org.apache.cassandra.db.index.sasi.utils.trie.Cursor.Decision;
import java.util.AbstractCollection;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.Map;


        if (!isBitSet(key, h.bitIndex))
        {
            if (selectR(h.left, h.bitIndex, key, reference))
            {
                return selectR(h.right, h.bitIndex, key, reference);
            }
        }
        else
        {
            if (selectR(h.right, h.bitIndex, key, reference))
            {
                return selectR(h.left, h.bitIndex, key, reference);
            }
        }

        return false;
    }
    
    /**
     * 
     */
    private boolean selectR(TrieEntry<K,V> h, int bitIndex, 
                            final K key, final Cursor<? super K, ? super V> cursor,
                            final Reference<Map.Entry<K, V>> reference)
    {
        if (h.bitIndex <= bitIndex)
        {
            if (!h.isEmpty())
            {
                Decision decision = cursor.select(h);