tree

package
v0.0.0-...-db2e5f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2019 License: BSD-2-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents a node in a tree

func NewNode

func NewNode(v interface{}) *Node

NewNode creates a new Node with value v and returns a pointer to that node

func (*Node) GetChildren

func (n *Node) GetChildren() []*Node

GetChildren returns list of node n's successors

func (*Node) GetValue

func (n *Node) GetValue() interface{}

GetValue returns node n's value

func (Node) MarshalJSON

func (node Node) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler interface It returns Node in JSON format

func (*Node) SetChildren

func (n *Node) SetChildren(children []*Node)

SetChildren sets children of a node n

func (*Node) String

func (n *Node) String() string

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

Tree represents a tree

func NewTree

func NewTree(root *Node) *Tree

NewTree creates a tree with given root node

func (*Tree) GetRoot

func (t *Tree) GetRoot() *Node

GetRoot returns root node of the tree

func (Tree) MarshalJSON

func (tree Tree) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler interface It returns Tree in JSON format

func (*Tree) String

func (t *Tree) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL