Package lib.aide.paths
Class Paths.Node
java.lang.Object
lib.aide.paths.Paths.Node
Represents a node in the hierarchical path structure.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabsolutePath
(boolean includeRoot) void
addAttribute
(String key, Object value) void
void
basename()
children()
void
Runs action for every node in the tree, depth firstgetAttribute
(String key) boolean
isLeaf()
boolean
isRoot()
issues()
mergeAttributes
(Map<String, Object> updates) parent()
payload()
void
Populates the tree structure with the specified components and payload.Resolves the relative path to a node in the tree structure.Resolves the relative components to a node in the tree structure.void
setPayload
(Optional<P> payload) siblings
(boolean withSelf) toString()
-
Constructor Details
-
Node
Constructs a new Node with the specified components, payload, and parent node.- Parameters:
components
- the components of the path for this nodepayload
- the payload associated with this nodeparent
- the parent node
-
-
Method Details
-
components
-
payload
-
setPayload
-
parent
-
addChild
-
addAttribute
-
mergeAttributes
-
getAttribute
-
addIssue
-
findChild
-
siblings
-
descendants
-
ancestors
-
isRoot
public boolean isRoot() -
isLeaf
public boolean isLeaf() -
absolutePath
-
absolutePath
-
basename
-
children
-
attributes
-
issues
-
populate
public void populate(List<C> components, Optional<P> payload, int index, Paths.InterimPayloadSupplier<C, P> ips) Populates the tree structure with the specified components and payload. If a parent is not already created, it's called an "interim" node and will have an "interim payload" which can be empty for default behavior. An empty interim payload will be filled in with a final payload if it's supplied later.- Parameters:
components
- the components to addpayload
- payload associated with the terminal componentindex
- the current index in the components listips
- payload associated with an interim component
-
resolve
Resolves the relative components to a node in the tree structure.- Parameters:
relativeComponents
- the relative components to resolve- Returns:
- an Optional containing the resolved node if found, or an empty Optional
-
resolve
Resolves the relative path to a node in the tree structure.- Parameters:
relativePath
- the relative path to resolve- Returns:
- an Optional containing the resolved node if found, or an empty Optional
-
toString
-
forEach
Runs action for every node in the tree, depth first- Parameters:
action
- callback to rundepthFirst
- true to run depth-first
-