Ejemplo n.º 1
0
/**
 * Finds a node by its path
 *
 * <p>Paths may be generated with {@link #getPath(CommandNode)}, and are guaranteed (for the same tree, and the
 * same version of this library) to always produce the same valid node by this method.</p>
 *
 * <p>If a node could not be found at the specified path, then {@code null} will be returned.</p>
 *
 * @param path a generated path to a node
 * @return the node at the given path, or null if not found
 */
        public CommandNode <TSource> FindNode(IEnumerable <string> path)
        {
            CommandNode <TSource> node = _root;

            foreach (var name in path)
            {
                node = node.GetChild(name);
                if (node == null)
                {
                    return(null);
                }
            }

            return(node);
        }