Reset this cursor for the provided tree, to iterate over its entire range

@param btree    the tree to iterate over
@param forwards if false, the cursor will start at the end and move backwards
772170
public void reset(Object[] btree, boolean forwards)
    {
        _reset(btree, null, NEGATIVE_INFINITY, false, POSITIVE_INFINITY, false, forwards);
    }
612762
private void deleteNode() throws TTException {
        /*
         * If found in one of the rightsiblings in the current shreddered
         * structure remove all nodes until the transaction points to the found
         * node (keyMatches).
         */
        if (mInserted && !mMovedToRightSibling) {
            mInserted = false;
            if (((ITreeStructData)mWtx.getNode()).hasRightSibling()) {
                // Cursor is on the inserted node, so move to right sibling.
                mWtx.moveTo(((ITreeStructData)mWtx.getNode()).getRightSiblingKey());
            }
        }

        // // Check if transaction is on the last node in the shreddered file.
        // checkIfLastNode(true);

        // Determines if transaction has moved to the parent node after a delete
        // operation.
        boolean movedToParent = false;

        // Determines if ldeleteNodeast node in a subtree is going to be
        // deleted.
        boolean isLast = false;

        do {
            if (mWtx.getNode().getDataKey() != mKeyMatches) {
                final ITreeStructData node = (ITreeStructData)mWtx.getNode();
                if (!node.hasRightSibling() && !node.hasLeftSibling()) {
                    // if (mDelete == EDelete.ATSTARTMIDDLE) {
                    // // If the delete occurs right before an end tag the
                    // // level hasn't been incremented.
                    // mLevelInShreddered--;
                    // }
                    /*
                     * Node has no right and no left sibling, so the transaction
                     * moves to the parent after the delete.
                     */
                    movedToParent = true;
                } else if (!node.hasRightSibling()) {
                    // Last node has been reached, which means that the
                    // transaction moves to the left sibling.
                    isLast = true;
                }

                mWtx.remove();
            }
        } while (mWtx.getNode().getDataKey() != mKeyMatches && !movedToParent && !isLast);

        if (movedToParent) {
            if (mDelete == EDelete.ATBOTTOM) {
                /*
                 * Deleted right before an end tag has been parsed, thus don't
                 * move transaction to next node in processEndTag().
                 */
                mRemovedNode = true;
            }
            /*
             * Treetank transaction has been moved to parent, because all child
             * nodes have been deleted, thus to right sibling.
             */
            mWtx.moveTo(((ITreeStructData)mWtx.getNode()).getRightSiblingKey());
        } else {
            if (((ITreeStructData)mWtx.getNode()).hasFirstChild()) {
                if (mDelete == EDelete.ATBOTTOM && isLast) {
                    /*
                     * Deleted right before an end tag has been parsed, thus
                     * don't move transaction to next node in processEndTag().
                     */
                    mRemovedNode = true;
                }

                if (isLast) {
                    // If last node of a subtree has been removed, move to
                    // parent and right sibling.
                    mWtx.moveTo(mWtx.getNode().getParentKey());
                    mWtx.moveTo(((ITreeStructData)mWtx.getNode()).getRightSiblingKey());

                    // // If the delete occurs right before an end tag the level
                    // // hasn't been incremented.
                    // if (mDelete == EDelete.ATSTARTMIDDLE) {
                    // mLevelInShreddered--;
                    // }
                }
            }
        }

        // Check if transaction is on the last node in the shreddered file.
        // checkIfLastNode(true);
        mInsert = EInsert.NOINSERT;
    }
901576
function Cursor(tree, start, end) {
        this.tree = tree;
        this.start = start;
        this.end = end;
        
        var self = this;
        this.walk = function walk(node, iterator) {
            if (node === null) return;
            
            if (start !== undefined && node.key < start) {
                walk(node.right, iterator);
            } else if (end !== undefined && node.key > end) {
                walk(node.left, iterator);
            } else {
                walk(node.left, iterator);
                iterator(node.value, node.key, self.tree);
                walk(node.right, iterator);
            }
        };
    }
96704
public static <T> KeyRange<T> closed(final T start, final T stop) {
    return new KeyRange<>(KeyRangeType.FORWARD_CLOSED, start, stop);
  }
1374846
private void switchToForward() {
        assert(state == State.ITER_CHECK_BWD ||
                (state == State.ITER_IN_FCD_SEGMENT && pos == limit) ||
                (state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos == normalized.length()));
        if(state == State.ITER_CHECK_BWD) {
            // Turn around from backward checking.
            start = pos = iter.getIndex();
            if(pos == limit) {
                state = State.ITER_CHECK_FWD;  // Check forward.
            } else {  // pos < limit
                state = State.ITER_IN_FCD_SEGMENT;  // Stay in FCD segment.
            }
        } else {
            // Reached the end of the FCD segment.
            if(state == State.ITER_IN_FCD_SEGMENT) {
                // The input text segment is FCD, extend it forward.
            } else {
                // The input text segment needed to be normalized.
                // Switch to checking forward from it.
                if(state == State.IN_NORM_ITER_AT_START) {
                    iter.moveIndex(limit - start);
                }
                start = limit;
            }
            state = State.ITER_CHECK_FWD;
        }
    }
1322340
protected void setTreeGraph(TreeGraph tg) {
    this.tg = tg;
    for (TreeGraphNode child : children) {
      child.setTreeGraph(tg);
    }
  }
266220
private void processForwardDeclare(Node n, Node parent) {
    CodingConvention convention = compiler.getCodingConvention();

    String typeDeclaration = null;
    try {
      typeDeclaration = Iterables.getOnlyElement(
          convention.identifyTypeDeclarationCall(n));
    } catch (NullPointerException | NoSuchElementException | IllegalArgumentException e) {
      compiler.report(
          JSError.make(
              n,
              INVALID_FORWARD_DECLARE,
              "A single type could not identified for the goog.forwardDeclare statement"));
    }

    if (typeDeclaration != null) {
      compiler.forwardDeclareType(typeDeclaration);
      // Forward declaration was recorded and we can remove the call.
      Node toRemove = parent.isExprResult() ? parent : parent.getParent();
      NodeUtil.deleteNode(toRemove, compiler);
    }
  }
1288692
public void reset(int direction) {
        if(direction>0) {
            /* reset for forward iteration */
            this.dir=1;
            index=cpLimit;
        } else if(direction<0) {
            /* reset for backward iteration */
            this.dir=-1;
            index=cpStart;
        } else {
            // not a valid direction
            this.dir=0;
            index=0;
        }
        reachedLimit=false;
    }
1364720
public void setTree(CmsTree<CmsTreeItem> tree) {

        m_tree = tree;
        for (Widget widget : m_children) {
            if (widget instanceof CmsTreeItem) {
                ((CmsTreeItem)widget).setTree(tree);
            }
        }
    }
55584
function Iterator(tree, snapshot) {
  this.tree = tree;
  this.root = snapshot;
  this.current = snapshot;
  this.key = null;
  this.value = null;
}
211034
private void resetRoundRobin(String preferredNodeIdPrefix) {
        DisqueNode previous = null; // remember the previous node because the offset is a marker to start with the next
        // element
        for (DisqueNode disqueNode : getNodes()) {
            if (disqueNode.getNodeId().startsWith(preferredNodeIdPrefix)) {
                roundRobin = new RoundRobin<DisqueNode>(getNodes(), previous);
                return;
            }
            previous = disqueNode;
        }
    }
750378
public void clearTmpData() {
		for (Enumeration<?> e = breadthFirstEnumeration(); e.hasMoreElements(); ) {
			((LblTree) e.nextElement()).setTmpData(null);
		}
	}
1359314
public void setSearchSubtree(boolean searchSubtree) {
        int searchScope = searchSubtree ? SearchControls.SUBTREE_SCOPE : SearchControls.ONELEVEL_SCOPE;
        searchControls.setSearchScope(searchScope);
    }
768061
function forwardSearch() {
      cameFrom = open1Set.pop();
      if (cameFrom.closed) {
        return;
      }

      cameFrom.closed = true;

      if (cameFrom.f1 < lMin && (cameFrom.g1 + f2 - heuristic(from, cameFrom.node)) < lMin) {
        graph.forEachLinkedNode(cameFrom.node.id, forwardVisitor);
      }

      if (open1Set.length > 0) {
        // this will be used in reverse search
        f1 = open1Set.peek().f1;
      } 
    }
887098
def _cursor_forward(self, value):
        
        if value <= 0:
            value = 1
        self._cursor.movePosition(self._cursor.Right, self._cursor.MoveAnchor, value)
        self._text_edit.setTextCursor(self._cursor)
        self._last_cursor_pos = self._cursor.position()
299585
void successor()
    {
        Object[] node = currentNode();
        int i = currentIndex();

        if (!isLeaf(node))
        {
            // if we're on a key in a branch, we MUST have a descendant either side of us,
            // so we always go down the left-most child until we hit a leaf
            node = (Object[]) node[getBranchKeyEnd(node) + i + 1];
            while (!isLeaf(node))
            {
                push(node, -1);
                node = (Object[]) node[getBranchKeyEnd(node)];
            }
            push(node, 0);
            return;
        }

        // if we haven't reached the end of this leaf, just increment our index and return
        i += 1;
        if (i < getLeafKeyEnd(node))
        {
            // moved to the next key in the same leaf
            setIndex(i);
            return;
        }

        // we've reached the end of this leaf,
        // so go up until we reach something we've not finished visiting
        while (!isRoot())
        {
            pop();
            i = currentIndex() + 1;
            node = currentNode();
            if (i < getKeyEnd(node))
            {
                setIndex(i);
                return;
            }
        }

        // we've visited the last key in the root node, so we're done
        setIndex(getKeyEnd(node));
    }
1092429
public void reset()
  {
    // If the stack was previously allocated, assume that about the same
    // amount of stack space will be needed again; otherwise, use a very
    // large stack size.
    int linksSize = (_links == null) ? XPathContext.RECURSIONLIMIT
                                     : _links.length;
    int varArraySize = (_stackFrames == null) ? XPathContext.RECURSIONLIMIT * 2
                                              : _stackFrames.length;
    reset(linksSize, varArraySize);
  }