tree

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseLHS

func UseLHS[T any](a, _ T) T

UseLHS returns its LHS arg.

func UseRHS

func UseRHS[T any](_, b T) T

UseRHS returns its RHS arg.

Types

type Builder

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

Builder[T] provides a more efficient way to build nodes incrementally.

func NewBuilder

func NewBuilder[T any](int) *Builder[T]

func (*Builder[T]) Add

func (b *Builder[T]) Add(v T)

func (*Builder[T]) Borrow

func (b *Builder[T]) Borrow() Tree[T]

func (*Builder[T]) Count

func (b *Builder[T]) Count() int

func (*Builder[T]) Finish

func (b *Builder[T]) Finish() Tree[T]

func (Builder[T]) Format

func (b Builder[T]) Format(state fmt.State, verb rune)

func (*Builder[T]) Get

func (b *Builder[T]) Get(el T) *T

func (*Builder[T]) Remove

func (b *Builder[T]) Remove(v T)

func (Builder[T]) String

func (b Builder[T]) String() string

type CombineArgs

type CombineArgs[T any] struct {
	*EqArgs[T]
	// contains filtered or unexported fields
}

func DefaultNPCombineArgs

func DefaultNPCombineArgs[T any]() *CombineArgs[T]

DefaultNPCombineArgs provides default combiner with non-parallel behaviour.

func DefaultNPKeyCombineArgs

func DefaultNPKeyCombineArgs[T any]() *CombineArgs[T]

func NewCombineArgs

func NewCombineArgs[T any](ea *EqArgs[T], combine func(a, b T) T) *CombineArgs[T]

func (*CombineArgs[T]) Flip

func (a *CombineArgs[T]) Flip() *CombineArgs[T]

type EqArgs

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

func DefaultNPEqArgs

func DefaultNPEqArgs[T any]() *EqArgs[T]

DefaultNPEqArgs provides default equality with non-parallel behaviour.

func DefaultNPKeyEqArgs

func DefaultNPKeyEqArgs[T any]() *EqArgs[T]

func NewDefaultEqArgs

func NewDefaultEqArgs[T any](gauge depth.Gauge) *EqArgs[T]

func NewDefaultKeyEqArgs

func NewDefaultKeyEqArgs[T any](gauge depth.Gauge) *EqArgs[T]

func NewEqArgs

func NewEqArgs[T any](
	gauge depth.Gauge,
	eq func(a, b T) bool,
	hash func(a T, seed uintptr) uintptr,
) *EqArgs[T]

type Iterator added in v1.4.0

type Iterator[T any] interface {
	Next() bool
	Value() T
}

Iterator provides for iterating over a Set.

func Empty added in v1.4.0

func Empty[T any]() Iterator[T]

Empty is the empty iterator.

type Less

type Less[T any] func(a, b T) bool

Less dictates the order of two elements.

type NodeArgs

type NodeArgs struct {
	depth.Gauge
}

func NewNodeArgs

func NewNodeArgs(gauge depth.Gauge) NodeArgs

type Tree

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

func Map added in v1.5.0

func Map[T, U any](t Tree[T], f func(v T) U) (out Tree[U])

func (Tree[T]) Combine

func (t Tree[T]) Combine(args *CombineArgs[T], u Tree[T]) (out Tree[T])

func (Tree[T]) Count

func (t Tree[T]) Count() int

func (Tree[T]) Difference

func (t Tree[T]) Difference(gauge depth.Gauge, u Tree[T]) (out Tree[T])

func (Tree[T]) Equal

func (t Tree[T]) Equal(args *EqArgs[T], u Tree[T]) bool

func (Tree[T]) Format

func (t Tree[T]) Format(f fmt.State, verb rune)

func (Tree[T]) Gauge

func (t Tree[T]) Gauge() depth.Gauge

func (Tree[T]) Get

func (t Tree[T]) Get(v T) *T

func (Tree[T]) Intersection

func (t Tree[T]) Intersection(gauge depth.Gauge, u Tree[T]) (out Tree[T])

func (Tree[T]) Iterator

func (t Tree[T]) Iterator() Iterator[T]

func (Tree[T]) OrderedIterator

func (t Tree[T]) OrderedIterator(less Less[T], n int) Iterator[T]

func (Tree[T]) Reduce

func (t Tree[T]) Reduce(args NodeArgs, r func(values ...T) T) (_ T, _ bool)

func (Tree[T]) String

func (t Tree[T]) String() string

func (Tree[T]) SubsetOf

func (t Tree[T]) SubsetOf(gauge depth.Gauge, u Tree[T]) bool

func (Tree[T]) Vet

func (t Tree[T]) Vet()

func (Tree[T]) Where

func (t Tree[T]) Where(args *WhereArgs[T]) (out Tree[T])

func (Tree[T]) With

func (t Tree[T]) With(v T) (out Tree[T])

func (Tree[T]) Without

func (t Tree[T]) Without(v T) (out Tree[T])

type WhereArgs

type WhereArgs[T any] struct {
	NodeArgs

	Pred func(elem T) bool
}

Jump to

Keyboard shortcuts

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