counter

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRatioToRoot

func CalculateRatioToRoot[T any](descendantTreeCount *DescendantTreeCount[*T])

func TraverseTreePost

func TraverseTreePost[T TreeProvider[T]](node T, yield func(T, *T, bool) bool)

Types

type DescendantTracker

type DescendantTracker[T any] struct {
	Parent   *T
	Children []*DescendantTreeCount[*T]
}

type DescendantTreeCount

type DescendantTreeCount[T any] struct {
	Count               int
	ChildrenCount       int
	RatioToParent       float64
	RatioToRoot         float64
	BelowThresholdCount int
	// contains filtered or unexported fields
}

func CollectAllNodes

func CollectAllNodes[T any](descendantTreeCount *DescendantTreeCount[*T]) []*DescendantTreeCount[*T]

func CountDescendantTree

func CountDescendantTree[T TreeProvider[T]](root T) *DescendantTreeCount[*T]

func FilterDescendantTree

func FilterDescendantTree[T any](descendantTreeCount *DescendantTreeCount[*T], threshold float64) *DescendantTreeCount[*T]

func NewDescendantTreeCount

func NewDescendantTreeCount[T any](node T) *DescendantTreeCount[T]

func SortDescendantTree

func SortDescendantTree[T any](descendantTreeCount *DescendantTreeCount[*T]) *DescendantTreeCount[*T]

func (*DescendantTreeCount[T]) Add

func (d *DescendantTreeCount[T]) Add(node *DescendantTreeCount[T])

func (*DescendantTreeCount[T]) Children

func (*DescendantTreeCount[T]) MarshalJSON

func (d *DescendantTreeCount[T]) MarshalJSON() ([]byte, error)

func (*DescendantTreeCount[T]) Node

func (d *DescendantTreeCount[T]) Node() *DescendantTreeCount[T]

func (*DescendantTreeCount[T]) NodeValue

func (d *DescendantTreeCount[T]) NodeValue() T

func (*DescendantTreeCount[T]) SetChildren

func (d *DescendantTreeCount[T]) SetChildren(children []*DescendantTreeCount[T])

func (*DescendantTreeCount[T]) SetNode

func (d *DescendantTreeCount[T]) SetNode(node T)

func (*DescendantTreeCount[T]) String

func (d *DescendantTreeCount[T]) String() string

type Tree

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

func CopyTree

func CopyTree[T TreeProvider[T]](root T) Tree[T]

func FilterTree

func FilterTree[T TreeProvider[T]](root T, filter func(T) bool) *Tree[T]

func (*Tree[T]) Children

func (t *Tree[T]) Children() iter.Seq[Tree[T]]

type TreeProvider

type TreeProvider[T any] = collections.TreeProvider[T]

type TreeTraversePostTracker

type TreeTraversePostTracker[F any, T any] struct {
	Parent   *F
	Children []*T
}

Jump to

Keyboard shortcuts

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