Returns the root of the tree containing this node.
@return the {@link AstRoot} at the root of this node's parent
chain, or {@code null} if the topmost parent is not an {@code AstRoot}.
160375
public AstRoot getAstRoot() {
        AstNode parent = this;  // this node could be the AstRoot
        while (parent != null && !(parent instanceof AstRoot)) {
            parent = parent.getParent();
        }
        return (AstRoot)parent;
    }
1072143
public static <T> T root(TreeDef.Parented<T> treeDef, T node) {
		T lastParent;
		T parent = node;
		do {
			lastParent = parent;
			parent = treeDef.parentOf(lastParent);
		} while (parent != null);
		return lastParent;
	}
960262
public CfgParseTree getBestParseTree() {
    Factor rootMarginal = getMarginalEntries(0, chartSize() - 1);
    Assignment bestAssignment = rootMarginal.getMostLikelyAssignments(1).get(0);
    return getBestParseTree(bestAssignment.getOnlyValue());
  }
863719
public static Throwable getRootCause(Throwable t) {
        if (t == null) {
            return null;
        }
        while (t.getCause() != null) {
            t = t.getCause();
        }
        return t;
    }
160125
public Map getRootData() {
		for (Scope cur=this; true; cur=cur.parent) {
			if (cur.parent == null) {
				return cur.data;
			}
		}
	}
13340
private Node getParentNode(Node node) {

		if (node == null || node == root)
			return null;

		Node newNode = node.getParentNode();
		if (newNode == null)
			return null;

		int accept = acceptNode(newNode);

		if (accept == NodeFilter.FILTER_ACCEPT)
			return newNode;
		else
			// if (accept == NodeFilter.SKIP_NODE)
			// and REJECT too.
			return getParentNode(newNode);

	}
865996
public Node<T> getNext(Node<T> node) {
    	if (node.right != null) {
    		node = node.right;
    		while (node.left != null) node = node.left;
    		return node;
    	}
    	// nothing at right, it may be the parent node if the node is at the left
    	if (node == last) return null;
    	return getNext(root, node.value);
    }
372795
public Exception getRootCause() {
		if (exception instanceof ServiceLocatorException) {
			return ((ServiceLocatorException) exception).getRootCause();
		}
		return exception == null ? this : exception;
	}
869213
public LeafNode<K, V> prevNode() {
		if (leftid == NULL_ID) {
			return null;
		}
		return (LeafNode<K, V>) tree.getNode(leftid);
	}
517633
public static TreeElement getRoot(TreeElement node)
    {
        TreeElement parentNode = node.getParent();
        while (parentNode != null) {
            node = parentNode;
            parentNode = node.getParent();
        }
        return node;
    }
552944
@Override
    public Node getParentNode(String parentNodeId)
    {
        NodeLink link = new NodeLink(parentNodeId, getNodeId());

        if (this.parents == null)
        {
            return null;
        }
        else
        {
            return this.parents.get(link);
        }
    }
504497
public LeafNode<K, V> nextNode() {
		if (rightid == NULL_ID) {
			return null;
		}
		return (LeafNode<K, V>) tree.getNode(rightid);
	}
1261967
public List<T> getRoots() {
    List<T> roots = new ArrayList<>();
    for (DirectedAcyclicGraphNode<T> root : mRoots) {
      roots.add(root.getPayload());
    }
    return roots;
  }
1211165
def root(self):
        ''''''
        with self._mutex:
            if self._parent:
                return self._parent.root
            else:
                return self
461607
protected DefaultMutableTreeNode getDataAsTree() {
        try {
            return (DefaultMutableTreeNode) MethodUtils.invokeMethod(view, "getDataAsTree", null);
        } catch (Exception e) {
            return null;
        }
    }
581078
public function getRoot()
    {
        $next_parent = $this->getParent();
        $parent = null;
        while ($next_parent) {
            $parent = $next_parent;
            $next_parent = $parent->getParent();
        }

        return $parent ? $parent : $this;
    }
418136
private TreeNode getParentTreeNode(TreeNode child) {
        TreeNode parentTreeNode = parentIndex.get(child);

        if (parentTreeNode == null)
            return null;

        // Makes sure the parent node is still present in the tree
        else if (contains(parentTreeNode.getQueryNode()))
            return parentTreeNode;
        else
            throw new RuntimeException("Internal error: points to a parent that is not (anymore) in the tree");
    }