This method builds the node hierarchy.

@return The node hierarchy
184330
public Node build() {
        ContainerNode ret = null;

        if (nodeType == NodeType.Component) {
            ret = new Component();
            ((Component) ret).setComponentType(componentType);
        } else if (nodeType == NodeType.Consumer) {
            ret = new Consumer();
            ((Consumer) ret).setEndpointType(endpointType);
        } else if (nodeType == NodeType.Producer) {
            ret = new Producer();
            ((Producer) ret).setEndpointType(endpointType);
        }
        ret.setCorrelationIds(correlationIds);
        ret.setOperation(operation);
        ret.setProperties(properties);
        ret.setUri(uri);
        ret.setDuration(duration);
        ret.setTimestamp(timestamp);

        for (int i = 0; i < nodes.size(); i++) {
            ret.getNodes().add(nodes.get(i).build());
        }

        // Check if template has been supplied for URI
        NodeUtil.rewriteURI(ret);

        return ret;
    }
940039
def ancestors
      node  = self
      nodes = []
      nodes << node = node.parent while node.parent
      nodes
    end
393741
public List<List<AbstractFeature>> getFlattenFeatureHierarchy() {
        List<List<AbstractFeature>> result = new ArrayList<>();

        List<AbstractFeature> previousLevel = new ArrayList<>(getSortedFeatures());
        result.add(previousLevel);

        while (!previousLevel.isEmpty()) {
            List<AbstractFeature> currentLevel = new ArrayList<>();
            boolean isTopLevel = true;

            for (AbstractFeature feature : previousLevel) {
                if (feature.getParentGroup() != null) {
                    isTopLevel = false;
                    currentLevel.add(feature.getParentGroup());
                } else {
                    currentLevel.add(feature);
                }

            }

            if (!isTopLevel) {
                result.add(currentLevel);
                previousLevel = currentLevel;
            } else {
                previousLevel = new ArrayList<>();
            }
        }

        Collections.reverse(result);

        return result;
    }
1112759
public Node getNode() {
        if (node == null) {
            if (resource != null) {
                node = resource.adaptTo(Node.class);
            }
        }
        return node;
    }
1012708
public Inheritance<Entity<T>> getOrCreateInheritance()
   {
      Node node = childNode.getOrCreate("inheritance");
      Inheritance<Entity<T>> inheritance = new InheritanceImpl<Entity<T>>(this, "inheritance", childNode, node);
      return inheritance;
   }
613654
public function buildLineages() {				
		$indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false);
		
		if(count($indis) == 0) return null;
		
		$root_lineages = array();
		
		foreach($indis as $indi) {
			$pid = $indi->getXref();
			if(!isset($this->used_indis[$pid])){
				//Find the root of the lineage
				/** @var Fisharebest\Webtrees\Individual $indiFirst  */
				$indiFirst= $this->getLineageRootIndividual($indi);
				if($indiFirst){
					$this->used_indis[$indiFirst->getXref()] = true;
					if($indiFirst->canShow()){
						//Check if the root individual has brothers and sisters, without parents
						$indiChildFamily = $indiFirst->getPrimaryChildFamily();
						if($indiChildFamily !== null){
							$root_node = new LineageRootNode(null); 
							$root_node->addFamily($indiChildFamily);
						}
						else{
							$root_node = new LineageRootNode($indiFirst);
						}
						$root_node = $this->buildLineage($root_node);		
						if($root_node) $root_lineages[] = $root_node;
					}
				}
			}
		}
		
		return $root_lineages;		
	}
219857
private StringTreeNode buildOrgHierarchyTree(final Object[] data) {
		StringTreeNode childNode = new StringTreeNode((String) data[0]);

		if (data.length > 1) {
			for (int i = 1; i < data.length; i++) {
				childNode.add(buildOrgHierarchyTree((Object[]) data[i]));
			}
		}

		return childNode;
	}
705874
private NodeBuilder ensureParent()
    {
        if (parent == null)
        {
            parent = new NodeBuilder();
            parent.child = this;
        }
        if (parent.upperBound == null)
            parent.reset(EMPTY_BRANCH, upperBound, updateFunction, comparator);
        return parent;
    }
680090
def _create_intermediate_nodes(self, name):
        """"""
        hierarchy = self._split_node_name(name, self.root_name)
        node_tree = [
            self.root_name
            + self._node_separator
            + self._node_separator.join(hierarchy[: num + 1])
            for num in range(len(hierarchy))
        ]
        iobj = [
            (child[: child.rfind(self._node_separator)], child)
            for child in node_tree
            if child not in self._db
        ]
        for parent, child in iobj:
            self._db[child] = {"parent": parent, "children": [], "data": []}
            self._db[parent]["children"] = sorted(
                self._db[parent]["children"] + [child]
            )
971214
public final List<T> getAncestors() {
      List<T> path = new ArrayList<>();
      HierarchicalEnumValue<T> hev = Cast.as(this);
      do {
         hev = Cast.as(hev.getParent());
         if (hev != null && hev != getSingleRoot()) {
            path.add(Cast.as(hev));
         }
      } while (hev != null && hev != getSingleRoot());
      return path;
   }
484766
protected N buildTree(int[] msg, int cur, int parent, ArrayList<N> nodes) {
    // Count the number of children:
    int c = 0;
    for(int i = 1; i < msg.length; i += 2) {
      if((msg[i - 1] == cur && msg[i] != parent) || (msg[i] == cur && msg[i - 1] != parent)) {
        c++;
      }
    }
    // Build children:
    List<N> children = Collections.emptyList();
    if(c > 0) {
      children = new ArrayList<>(c);
      for(int i = 1; i < msg.length; i += 2) {
        if(msg[i - 1] == cur && msg[i] != parent) {
          children.add(buildTree(msg, msg[i], cur, nodes));
        }
        else if(msg[i] == cur && msg[i - 1] != parent) {
          children.add(buildTree(msg, msg[i - 1], cur, nodes));
        }
      }
    }
    N node = makeNode(cur, children);
    nodes.set(cur, node);
    return node;
  }
94904
private function getRootNodes()
    {
        $output = array();
        foreach( $this->nodes as $node )
            if (! $node->parentCount() )
                $output[] = $node;
        return $output;
    }
1071708
public function buildTree()
    {
        $this->assertTreeHasRootNode();
        if (null !== $this->tree) {
            return $this->tree;
        }

        return $this->tree = $this->root->getNode(true);
    }
1005559
public synchronized Node masterNode() {
        final ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
        final String name = state.nodes().getMasterNode().getName();
        return getNode(name);
    }
1348220
public java.util.List<? extends org.tensorflow.framework.CostGraphDef.NodeOrBuilder> 
      getNodeOrBuilderList() {
    return node_;
  }
971665
public static List<Object> getAllNodes(TreeModel treeModel)
    {
        List<Object> result = new ArrayList<Object>();
        getAllDescendants(treeModel, treeModel.getRoot(), result);
        result.add(0, treeModel.getRoot());
        return result;
    }
205585
public List<Concept> getPathFromRoot() {
        LinkedList<Concept> path = new LinkedList<>();

        Concept node = this;
        while (node != null) {
            path.addFirst(node);
            node = node.parent;
        }

        return path;
    }