diff options
| author | Jeff Carr <[email protected]> | 2021-10-07 21:56:16 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-07 21:56:16 -0500 |
| commit | 0c9547a066386f82f8e724c0f61c4d31dc5351e2 (patch) | |
| tree | fd3ea3d4b3ba6cbb468f04f44334b00edee4f307 /new-structs.go | |
| parent | 55a9759ab8fdc855670c6aa52ecd8362c5337a18 (diff) | |
NODE: continued work on implementing a node tree
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'new-structs.go')
| -rw-r--r-- | new-structs.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/new-structs.go b/new-structs.go index 03b6b94..a9cd2a6 100644 --- a/new-structs.go +++ b/new-structs.go @@ -80,10 +80,31 @@ func (n *Node) Append(child *Node) { // } n.children = append(n.children, child) } + func (n *Node) List() { findByIdDFS(n, "test") } +func (n *Node) ListChildren() { + log.Println("gui.Node.ListChildren() node =", n.Name, n) + + if len(n.children) == 0 { + log.Println("\t\tNo children START") + return + } +// if len(n.children) > 0 { + for _, child := range n.children { + log.Println("gui.Node.ListChildren() child =", child.Name, child) + if (child.children == nil) { + log.Println("\t\tNo children END") + break + } + log.Println("\t\tHas children:", child.children) + child.ListChildren() + } + return +} + func findByIdDFS(node *Node, id string) *Node { log.Println("findByIdDFS()", id, node) node.Dump() |
