Returns the last component of a node's full path (i.e. its child name in its parent).
@param node A tree node's full path.
@return The last component of a node's full path.
433570
public static String child(String node) {
        final int index = node.lastIndexOf('/');
        if (index < 0 || index == node.length() - 1)
            return null;
        return node.substring(index + 1, node.length());
    }
1216178
@SuppressWarnings("unchecked")
	public TreeNode<T> findByPath(T... path) {
		return findByPath(Arrays.asList(path));
	}
844710
private void getLastChild() {

        // nodekey of the root of the current subtree
        final long parent = getNode().getDataKey();

        // traverse tree in pre order to the leftmost leaf of the subtree and
        // push
        // all nodes to the stack
        if (((ITreeStructData)getNode()).hasFirstChild()) {
            while (((ITreeStructData)getNode()).hasFirstChild()) {
                mStack.push(getNode().getDataKey());
                moveTo(((ITreeStructData)getNode()).getFirstChildKey());
            }

            // traverse all the siblings of the leftmost leave and all their
            // descendants and push all of them to the stack
            while (((ITreeStructData)getNode()).hasRightSibling()) {
                mStack.push(getNode().getDataKey());
                moveTo(((ITreeStructData)getNode()).getRightSiblingKey());
                getLastChild();
            }

            // step up the path till the root of the current subtree and process
            // all
            // right siblings and their descendants on each step
            if (getNode().hasParent() && (getNode().getParentKey() != parent)) {

                mStack.push(getNode().getDataKey());
                while (getNode().hasParent() && (getNode().getParentKey() != parent)) {

                    moveTo(getNode().getParentKey());

                    // traverse all the siblings of the leftmost leave and all
                    // their
                    // descendants and push all of them to the stack
                    while (((ITreeStructData)getNode()).hasRightSibling()) {

                        moveTo(((ITreeStructData)getNode()).getRightSiblingKey());
                        getLastChild();
                        mStack.push(getNode().getDataKey());
                    }
                }

                // set transaction to the node in the subtree that is last in
                // document
                // order
                moveTo(mStack.pop());
            }
        }
    }
1040772
public static boolean isLeaf(Node node) {
        return node instanceof Leaf || node.children() == null || node.children().size() == 0;
    }
1316233
public static <T extends GraphNode<T>> T getFirstChild(T node) {
        return hasChildren(node) ? node.getChildren().get(0) : null;
    }
382666
public static List<Node> getChildren(Node node, String childNodeName)
    {
        List<Node> children = new ArrayList<Node>();
        NodeList childNodes = node.getChildNodes();
        for (int i=0; i<childNodes.getLength(); i++)
        {
            Node child = childNodes.item(i);
            String childName = child.getNodeName();
            if (childName.equalsIgnoreCase(childNodeName))
            {
                children.add(child);
            }
        }
        return children;
    }
497345
public static <T> TreePath findPathFromEnclosingNodeToTopLevel(TreePath path, Class<T> klass) {
    if (path != null) {
      do {
        path = path.getParentPath();
      } while (path != null && !(klass.isInstance(path.getLeaf())));
    }
    return path;
  }
29059
private TreeElement findNodeRecurse(String fullName, String currentName)
    {
        String remainingName = null;

        if ((currentName == null) || (fullName == null)) {
            return null;
        }
        if (getName().equals(fullName)) {
            return this;
        }
        if (currentName.indexOf('.') > 0) {
            remainingName = currentName.substring(currentName.indexOf('.') + 1);
            int nextIndex = -1;
            if (remainingName.indexOf(".") > -1) {
                nextIndex = new Integer(remainingName.substring(0, remainingName.indexOf('.'))).intValue();
            }
            else {
                nextIndex = new Integer(remainingName).intValue();
            }

            TreeElement child = getChild(nextIndex);
            if (child != null) {
                return child.findNodeRecurse(fullName, remainingName);
            }
            else {
                return null;
            }
        }
        return null;
    }
1332677
public int getLastChild(int nodeHandle)
  {

    int identity = makeNodeIdentity(nodeHandle);
    int child = _firstch(identity);
    int lastChild = DTM.NULL;

    while (child != DTM.NULL)
    {
      lastChild = child;
      child = _nextsib(child);
    }

    return makeNodeHandle(lastChild);
  }
672849
function(root, path) {
				if (path.indexOf(this.SEPARATOR) === 0) {
					root = this.rootNode;
					path = path.substring(1);
				} else {
					if (!root) {
						if (!this.currentDirectory) {
							/* no node to resolve the path in terms of */
							return null;
						}
						root = this.currentDirectory;
					}
				}
				var segments = path.substring(0, path.lastIndexOf(this.SEPARATOR)).split(this.SEPARATOR);
				var result = root;
				for (var i = 0; i < segments.length; i++) {
					if (segments[i].length > 0) {
						result = this.getChild(result, segments[i]);
						if (!result || !result.Directory) {
							/* non-existent directory */
							return null;
						}
					}
				}

				/*
				 * If the full path represents a directory then initiate the
				 * retrieval of its full node info and children.
				 */
				var lastSegment = path.substring(path.lastIndexOf(this.SEPARATOR) + 1);
				var child = this.getChild(result, lastSegment);
				if (child) {
					this._retrieveNode(child);
				}

				if (!result.Children) {
					this._retrieveNode(result);
				}
				return result;
			}
597555
public static <T extends GraphNode<T>> T getLastChild(T node) {
        return hasChildren(node) ? node.getChildren().get(node.getChildren().size() - 1) : null;
    }
759646
public static Node getNode(Object root, String path) {
        return getNode(root, Path.create(path));
    }
1280217
public void addLast(final T node) {
        if ( this.firstNode == null ) {
            this.firstNode = node;
            this.lastNode = node;
        } else {
            T currentLast = this.lastNode;
            currentLast.setNext( node );
            node.setPrevious( currentLast );
            this.lastNode = node;            
        }
        
        this.size++;
    }
1091268
protected Node removeNode( Node node )
    {
        // Remove node.
        node.previous.next = node.next;
        node.next.previous = node.previous;
        node.removed = true;
        return node;
    }
340333
public static Node getNode(Object root, Path path) {
         return path.getNode(convertToJson(root, "actual"));
     }
1059449
public static <T extends HierarchyEntity<T, ?>> List<T> getPath(final T node) {
    List<T> path = CollectUtils.newArrayList();
    T curNode = node;
    while (null != curNode && !path.contains(curNode)) {
      path.add(0, curNode);
      curNode = curNode.getParent();
    }
    return path;
  }
511081
function getNodePath(node) {
    var nodePaths = [];
    var nodeParent = node;
    while (nodeParent) {
        switch (nodeParent.nodeType) {
            case NodeType.ELEM:
                nodePaths.unshift(nodeParent.tagName);
                break;

            case NodeType.IF:
                nodePaths.unshift('if');
                break;

            case NodeType.FOR:
                nodePaths.unshift('for[' + nodeParent.anode.directives['for'].raw + ']'); // eslint-disable-line dot-notation
                break;

            case NodeType.SLOT:
                nodePaths.unshift('slot[' + (nodeParent.name || 'default') + ']');
                break;

            case NodeType.TPL:
                nodePaths.unshift('template');
                break;

            case NodeType.CMPT:
                nodePaths.unshift('component[' + (nodeParent.subTag || 'root') + ']');
                break;

            case NodeType.TEXT:
                nodePaths.unshift('text');
                break;
        }

        nodeParent = nodeParent.parent;
    }

    return nodePaths;
}