public final class CommandTree
extends java.lang.Object
| Constructor and Description |
|---|
CommandTree(Blade blade) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommand(@NotNull java.util.List<java.lang.String> labels,
@NotNull BladeCommand command)
Adds a command to the tree.
|
Blade |
blade() |
@Nullable CommandTreeNode |
findNode(@NotNull java.util.List<java.lang.String> path)
Finds a command node by traversing the path.
|
boolean |
removeCommand(@NotNull java.util.List<java.lang.String> labels,
@NotNull BladeCommand command)
Removes a command from the tree.
|
@Nullable CommandTreeNode |
root(@NotNull java.lang.String label)
Gets a root node by label.
|
java.util.Map<java.lang.String,CommandTreeNode> |
roots() |
public CommandTree(Blade blade)
public void addCommand(@NotNull
@NotNull java.util.List<java.lang.String> labels,
@NotNull
@NotNull BladeCommand command)
labels - the command path (e.g., ["a", "b", "c"] for command "a b c")command - the command to associate with this pathpublic boolean removeCommand(@NotNull
@NotNull java.util.List<java.lang.String> labels,
@NotNull
@NotNull BladeCommand command)
labels - the command path (e.g., ["a", "b", "c"] for command "a b c")command - the command to remove@Nullable public @Nullable CommandTreeNode root(@NotNull @NotNull java.lang.String label)
label - the root label@Nullable public @Nullable CommandTreeNode findNode(@NotNull @NotNull java.util.List<java.lang.String> path)
path - the path to traverse (e.g., ["a", "b", "c"] for command "a b c")public Blade blade()
public java.util.Map<java.lang.String,CommandTreeNode> roots()