Documentation ¶
Index ¶
- type DepthFirstWalker
- type NodeVisitor
- type Reader
- type Tree
- func (t *Tree) AddChild(from, to node.Node) error
- func (t *Tree) AddRoot(n node.Node) error
- func (t *Tree) Children(n node.Node) node.Nodes
- func (t *Tree) Copy() *Tree
- func (t *Tree) HasNode(id node.ID) bool
- func (t *Tree) Length() int
- func (t *Tree) Node(id node.ID) node.Node
- func (t *Tree) Nodes() node.Nodes
- func (t *Tree) Parent(n node.Node) node.Node
- func (t *Tree) RemoveNode(n node.Node) (node.Nodes, error)
- func (t *Tree) Replace(old node.Node, new node.Node) error
- func (t *Tree) Roots() node.Nodes
- type WalkConditions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DepthFirstWalker ¶
type DepthFirstWalker struct {
// contains filtered or unexported fields
}
DepthFirstWalker implements stateful depth-first Tree traversal.
func NewDepthFirstWalker ¶
func NewDepthFirstWalker(reader Reader, visitor NodeVisitor) *DepthFirstWalker
func NewDepthFirstWalkerWithConditions ¶
func NewDepthFirstWalkerWithConditions(reader Reader, visitor NodeVisitor, conditions WalkConditions) *DepthFirstWalker
func (*DepthFirstWalker) WalkAll ¶
func (w *DepthFirstWalker) WalkAll() error
type NodeVisitor ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree represents a simple Tree data structure.
func (*Tree) RemoveNode ¶
RemoveNode deletes the node from the Tree and returns the removed node.
type WalkConditions ¶
type WalkConditions struct { // Return true when the walker should stop traversing (before visiting current node) ShouldTerminate func(node.Node) bool // Whether we should visit the current node. Note: this will continue down the same traversal // path, only "skipping" over a single node (but still potentially visiting children later) // Return true to visit the current node. ShouldVisit func(node.Node) bool // Whether we should consider children of this node to be included in the traversal path. // Return true to traverse children of this node. ShouldContinueBranch func(node.Node) bool }
Click to show internal directories.
Click to hide internal directories.