Build the navigation structure.

@param hasSeparateGlobals  Has the project a separated globals.html file?
@return                    The root node of the generated navigation structure.
323095
function build(hasSeparateGlobals) {
                    var root = new output.NavigationItem('Index', 'index.html');
                    if (entryPoint == project) {
                        var globals = new output.NavigationItem('Globals', hasSeparateGlobals ? 'globals.html' : 'index.html', root);
                        globals.isGlobals = true;
                    }
                    var modules = [];
                    project.getReflectionsByKind(td.models.ReflectionKind.SomeModule).forEach(function (someModule) {
                        var target = someModule.parent;
                        var inScope = (someModule == entryPoint);
                        while (target) {
                            if (target.kindOf(td.models.ReflectionKind.ExternalModule))
                                return;
                            if (entryPoint == target)
                                inScope = true;
                            target = target.parent;
                        }
                        if (inScope) {
                            modules.push(someModule);
                        }
                    });
                    if (modules.length < 10) {
                        buildGroups(modules, root);
                    }
                    else {
                        buildGroups(entryPoint.getChildrenByKind(td.models.ReflectionKind.SomeModule), root, buildChildren);
                    }
                    return root;
                }
714083
public final S getGlobalScope() {
    S result = thisScope();
    while (result.getParent() != null) {
      result = result.getParent();
    }
    return result;
  }
596474
private CmsSitemapEntryBean convertNavigationTreeToBean(CmsObject cms, NavigationNode node, boolean isRoot) {

        CmsSitemapEntryBean bean = null;
        try {
            bean = prepareSitemapEntry(cms, node.getNavElement(), isRoot, false);
            bean.setSearchMatch(node.isMatch());
            List<NavigationNode> children = node.getChildren();
            List<CmsSitemapEntryBean> childBeans = Lists.newArrayList();
            if (children.size() > 0) {
                for (NavigationNode child : children) {
                    childBeans.add(convertNavigationTreeToBean(cms, child, false));
                }
            } else if (node.isLeaf()) {
                childBeans = Lists.newArrayList();
            } else {
                // no children in filter result, but can still load children by clicking on tree item
                childBeans = null;
            }
            bean.setChildren(childBeans);

        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
        return bean;
    }
1305401
def newGlobalNs(self, href, prefix):
        
        ret = libxml2mod.xmlNewGlobalNs(self._o, href, prefix)
        if ret is None:raise treeError('xmlNewGlobalNs() failed')
        __tmp = xmlNs(_obj=ret)
        return __tmp
1016263
public void getRelativePath(StringBuilder result, INode parserNode, INode node) {
		if (parserNode == node)
			return;
		if (isAncestor(parserNode, node)) {
			ICompositeNode parent = node.getParent();
			getRelativePath(result, parserNode, parent);
			int idx = 0;
			INode child = parent.getFirstChild();
			while(child != node && child.hasNextSibling()) {
				idx++;
				child = child.getNextSibling();
			}
			result.append("/").append(idx);
		} else {
			result.append("/..");
			getRelativePath(result, parserNode.getParent(), node);
		}
	}
415844
private void createNavigationInternal(StringBuffer buffer, List<CmsJspNavElement> navElements) {

        // take the element to render.
        CmsJspNavElement element = navElements.remove(0);
        int elementLevel = element.getNavTreeLevel();
        String spacing = getSpaces(elementLevel * 2);
        // render element:
        buffer.append(spacing).append("<li>\n");
        buffer.append(spacing).append("  <a href=\"");
        buffer.append(m_jsp.link(element.getResourceName()));
        buffer.append("\" title=\"");
        buffer.append(element.getNavText());
        buffer.append("\"");
        if (elementLevel == 1) {
            buffer.append(" class=\"bold\"");
        }
        buffer.append(">");
        buffer.append(element.getNavText());
        buffer.append("</a>\n");

        // peek at the next (list is depth - first by contract)
        if (!navElements.isEmpty()) {
            CmsJspNavElement child = navElements.get(0);
            int childLevel = child.getNavTreeLevel();
            if (elementLevel < childLevel) {
                // next one goes down a level: it is a child by tree means
                buffer.append(spacing).append("  <ul>\n");
            } else if (elementLevel == childLevel) {
                // it is a sibling: close our list item, no recursion
                buffer.append(spacing).append("</li>\n");
            } else {
                // next element gets up one layer
                // this has to happen because of the depth-first contract!
                buffer.append(spacing).append("  </li>\n").append(spacing).append("</ul>\n");
            }
            createNavigationInternal(buffer, navElements);
        } else {
            // no more next elements: get back and close all lists (by using the recursion we are in)
            buffer.append(spacing).append("  </li>\n").append(spacing).append("</ul>\n");
        }

    }
267871
function _buildLevel(nodes) {
		var level = []
		levels.push(level)
		var parents = []
		each(nodes, function(node) {
			if (!seenPaths[node.path]) {
				seenPaths[node.path] = true
				level.push(node.path)
			}
			if (node.isRoot) { return }

			node.parent.waitingForNumChildren -= 1

			if (node.parent.waitingForNumChildren == 0) {
				parents.push(node.parent)
			}
		})
		if (!parents.length) { return }
		_buildLevel(parents)
	}
1089714
public static OrganigramNode findTreeNode(OrganigramNode searchRoot, OrganigramNode selection) {
        if (selection == null || searchRoot == null) {
            return null;
        }

        if (searchRoot.equals(selection)) {
            return searchRoot;
        }

        if (searchRoot.getChildren() != null) {
            for (OrganigramNode child : searchRoot.getChildren()) {
                OrganigramNode childResult = findTreeNode(child, selection);
                if (childResult != null) {
                    return childResult;
                }
            }
        }

        return null;
    }
993242
public static Node<PluralType> findChild(Struct<PluralType> parent, PluralType type) {
    for (Node<PluralType> n : parent.nodes()) {
      if (n.type() == type) {
        return n;
      }
    }
    return null;
  }
1265244
protected void initTree(CmsResource rootRes) throws CmsException {

        m_currentRoot = rootRes;
        m_treeContainer.removeAllComponents();
        showHeader();
        CmsSitemapTreeController controller = new CmsSitemapTreeController(
            A_CmsUI.getCmsObject(),
            rootRes,
            this,
            m_treeContainer);

        // no need to escape a structure id
        JavaScript.eval(CmsGwtConstants.VAR_LOCALE_ROOT + "='" + rootRes.getStructureId() + "'");

        CmsSitemapUI ui = (CmsSitemapUI)(A_CmsUI.get());
        ui.getSitemapExtension().setSitemapTreeController(controller);
        CmsSitemapTreeNode root1 = controller.createRootNode();
        controller.initEventHandlers(root1);
        m_treeContainer.addComponent(root1);
        controller.onClickOpen(root1);
    }
1144506
private SqlNode navigationInDefine(SqlNode node, String alpha) {
		Set<String> prefix = node.accept(new PatternValidator(false));
		Util.discard(prefix);
		node = new NavigationExpander().go(node);
		node = new NavigationReplacer(alpha).go(node);
		return node;
	}
1231168
public LocationBuilder addAllPath(final ParserRuleContext ctx, final ParseTree... parts) {
    location.addAllSpan(getSpan(ctx));

    // FIXME
    if (parts != null && parts.length > 0) {
      for (final ParseTree parseTree : parts) {
        location
            .addAllSpan(parseTree instanceof ParserRuleContext ? getSpan((ParserRuleContext) parseTree)
                : getSpan((TerminalNode) parseTree));
      }
    }

    return this;
  }
705635
public static AccessibilityNodeInfoCompat getRoot(AccessibilityNodeInfoCompat node) {
        if (node == null) {
            return null;
        }

        AccessibilityNodeInfoCompat current = null;
        AccessibilityNodeInfoCompat parent = AccessibilityNodeInfoCompat.obtain(node);

        do {
            current = parent;
            parent = current.getParent();
        } while (parent != null);

        return current;
    }
504295
@Override
	public ResourceBundlePathsIterator getGlobalResourceBundlePaths(
			ConditionalCommentCallbackHandler commentCallbackHandler, Map<String, String> variants) {

		return getBundleIterator(getDebugMode(), globalBundles, commentCallbackHandler, variants);
	}
916369
private GBSNode nextNode(
                            DeleteStack    stack)
    {
        if (_eof)
            throw new RuntimeException("_eof is set on entry to nextNode()");

        boolean done = false;
        GBSNode q = null;
        GBSNode nextp = null;
        while ( !done )
        {
            if (stack.index() > GBSTree.maxDepth)
                throw new OptimisticDepthException(
                                                  "maxDepth (" + GBSTree.maxDepth +
                                                  ") exceeded in GBSIterator.nextNode().");
            switch (_s)
            {
            case NodeStack.VISIT_LEFT:
                _s = NodeStack.PROCESS_CURRENT;
                q = _p.leftChild();
                while (q != null)
                {
                    stack.push(_s, _p, "GBSIterator.nextNode:VISIT_LEFT");
                    _p = q;
                    q = _p.leftChild();
                }
                break;
            case NodeStack.PROCESS_CURRENT:
                _s = NodeStack.VISIT_RIGHT;
                done = true;
                nextp = _p;              /* Next node to visit                    */
                break;
            case NodeStack.VISIT_RIGHT:
                _s = NodeStack.DONE_VISITS;
                q = _p.rightChild();
                if (q != null)
                {
                    stack.push(_s, _p, "GBSIterator.nextNode:VISIT_RIGHT");
                    _s = NodeStack.VISIT_LEFT;
                    _p = _p.rightChild();
                }
                break;
            case NodeStack.DONE_VISITS:
                if (stack.index() <= 0)  /* Have finally hit end of sub-tree      */
                    done = true;
                else
                {
                    _s = stack.state();
                    _p = stack.node();
                    stack.pop();
                }
                break;
            default:
                throw new RuntimeException("Help!, _s = " + _s + ", _p = " + _p + ".");
            }                            /* switch(_s)                            */
        }                              /* while ( !done )                       */
        return nextp;
    }
975152
private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) {
		if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) {
			node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK;
		} else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) {
			node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK | 4;
		} else if (neighbourTile.header.bmin[2] > tile.header.bmin[2]) {
			node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 2;
		} else {
			node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 6;
		}
	}
1025518
@Override public WebViewMapFragment build() {
    if (options == null) {
      options = new GoogleWebMapType();
    }
    if (options instanceof GoogleWebMapType) {
      return GoogleWebViewMapFragment.newInstance(options);
    }
    if (options instanceof GoogleChinaMapType) {
      return GoogleChinaWebViewMapFragment.newInstance(options);
    }
    if (options instanceof LeafletMapType) {
      return LeafletWebViewMapFragment.newInstance(options);
    }
    return null;
  }