From ff1357c8daeca8a3b72c27d7767b9d4f7f97f8bf Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 25 Nov 2024 14:15:22 -0500 Subject: [PATCH] removed tree package --- internal/tree/node.go | 50 ------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 internal/tree/node.go diff --git a/internal/tree/node.go b/internal/tree/node.go deleted file mode 100644 index 9025b3d..0000000 --- a/internal/tree/node.go +++ /dev/null @@ -1,50 +0,0 @@ -package tree - -// Node is a struct containing nodes of a file tree. -type Node struct { - // can be nil - Parent *Node - Name string - // Empty value mean directory - Ext string - // cannot be nil; may have len 0 - Children []*Node -} - -// NewNode constructs and returns a Node instance. -// parent and children are optional and can be nil, -// in which case Parent will be stored as nil, -// but Children will be initialized as []*Node of len 0. -// If ext == "", the Node is a directory. -func NewNode(name string, ext string, parent *Node, children []*Node) *Node { - var c []*Node - if children == nil { - c = make([]*Node, 0) - } else { - c = children - } - n := &Node{ - Name: name, - Ext: ext, - Parent: parent, - Children: c, - } - return n -} - -func (n *Node) IsRoot() bool { - return n.Parent == nil -} - -func (n *Node) IsTail() bool { - return len(n.Children) == 0 -} - -func (n *Node) IsDir() bool { - return n.Ext == "" -} - -// TODO: Implement recursive depth-first traversal to process a tree - -func Traverse(root *Node) { -}