node

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 1 Imported by: 90

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node[T any] struct {
	// contains filtered or unexported fields
}

nolint:structcheck,gocritic Node is the base of Tree construction.

func New

func New[T any](data T) *Node[T]

New creates a new node.

func (*Node[T]) AddNext

func (n *Node[T]) AddNext(node *Node[T])

AddNext add node to current node.

func (*Node[T]) Backtrack

func (n *Node[T]) Backtrack() []*Node[T]

Backtrack retrieves a path from node to root.

func (*Node[T]) GetData

func (n *Node[T]) GetData() T

GetData retrieves data from node.

func (*Node[T]) GetID

func (n *Node[T]) GetID() int

GetID retrieves id from node.

func (*Node[T]) GetNexts

func (n *Node[T]) GetNexts() []*Node[T]

GetNexts retrieves the next nodes.

func (*Node[T]) GetPrevious

func (n *Node[T]) GetPrevious() *Node[T]

GetPrevious retrieves the next nodes.

func (*Node[T]) GetStructure

func (n *Node[T]) GetStructure() []string

GetStructure retrieves the node structure.

func (*Node[T]) IsLeaf

func (n *Node[T]) IsLeaf() bool

IsLeaf retrieves info if node is leaf.

func (*Node[T]) IsRoot

func (n *Node[T]) IsRoot() bool

IsRoot retrieves info if node is root.

func (*Node[T]) WithID

func (n *Node[T]) WithID(id int) *Node[T]

WithID retrieves data from node.

Jump to

Keyboard shortcuts

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