nodes

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TryGetOutputValue added in v0.17.0

func TryGetOutputValue[T any](output NodeOutput[T], fallback T) T

Types

type Alertable

type Alertable interface {
	Alert(version int, state NodeState)
}

type Dependent

type Dependent interface {
	Dependencies() []NodeDependency
}

type DifferenceData added in v0.11.0

type DifferenceData[T vector.Number] struct {
	A NodeOutput[T]
	B NodeOutput[T]
}

func (DifferenceData[T]) Process added in v0.11.0

func (cn DifferenceData[T]) Process() (T, error)

type DifferenceNode added in v0.11.0

type DifferenceNode = StructNode[float64, DifferenceData[float64]]

============================================================================

type DivideData added in v0.11.0

type DivideData[T vector.Number] struct {
	Dividend NodeOutput[T]
	Divisor  NodeOutput[T]
}

func (DivideData[T]) Process added in v0.11.0

func (cn DivideData[T]) Process() (T, error)

type DivideNode added in v0.11.0

type DivideNode = StructNode[float64, DivideData[float64]]

============================================================================

type Input added in v0.11.0

type Input struct {
	Name string
	Type string
}

type Named

type Named interface {
	Name() string
}

type Node

type Node interface {
	Versioned
	Stateful
	Dependent

	SetInput(input string, output Output)
	Outputs() []Output
	Inputs() []Input
}

type NodeDependency

type NodeDependency interface {
	Named
	Dependency() Node
	DependencyPort() string
}

type NodeOutput

type NodeOutput[T any] interface {
	NodeOutputReference
	Value() T
}

type NodeOutputReference added in v0.11.0

type NodeOutputReference interface {
	Node() Node
	Port() string
}

type NodeState

type NodeState int
const (
	Stale NodeState = iota
	Processed
	Error
)

type Output added in v0.11.0

type Output struct {
	Type       string
	NodeOutput NodeOutputReference
}

type Pathed added in v0.11.0

type Pathed interface {
	Path() string
}

type Processor added in v0.11.0

type Processor[T any] interface {
	Process() (T, error)
}

type StateData

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

func (StateData) State

func (s StateData) State() NodeState

type Stateful

type Stateful interface {
	State() NodeState
}

type StructNode

type StructNode[T any, G StructNodeProcesor[T]] struct {
	Data G
	// contains filtered or unexported fields
}

func Struct

func Struct[T StructNodeProcesor[G], G any](p T) *StructNode[G, T]

func (*StructNode[T, G]) AddSubscription

func (sn *StructNode[T, G]) AddSubscription(a Alertable)

func (StructNode[T, G]) Dependencies

func (sn StructNode[T, G]) Dependencies() []NodeDependency

func (StructNode[T, G]) Inputs added in v0.11.0

func (sn StructNode[T, G]) Inputs() []Input

func (StructNode[T, G]) Name

func (sn StructNode[T, G]) Name() string

func (*StructNode[T, G]) Node added in v0.11.0

func (sn *StructNode[T, G]) Node() Node

func (*StructNode[T, G]) Out added in v0.11.0

func (sn *StructNode[T, G]) Out() StructNodeOutput[T, G]

func (StructNode[T, G]) Outdated

func (sn StructNode[T, G]) Outdated() bool

func (*StructNode[T, G]) Outputs added in v0.11.0

func (sn *StructNode[T, G]) Outputs() []Output

func (StructNode[T, G]) Path added in v0.11.0

func (sn StructNode[T, G]) Path() string

func (*StructNode[T, G]) Port added in v0.11.0

func (sn *StructNode[T, G]) Port() string

func (*StructNode[T, G]) SetInput added in v0.11.0

func (sn *StructNode[T, G]) SetInput(input string, output Output)

func (*StructNode[T, G]) State

func (sn *StructNode[T, G]) State() NodeState

func (StructNode[T, G]) Type added in v0.11.0

func (sn StructNode[T, G]) Type() string

func (*StructNode[T, G]) Value added in v0.11.0

func (sn *StructNode[T, G]) Value() T

func (StructNode[T, G]) Version

func (sn StructNode[T, G]) Version() int

type StructNodeDependency

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

func (StructNodeDependency) Dependency

func (snd StructNodeDependency) Dependency() Node

func (StructNodeDependency) DependencyPort added in v0.11.0

func (snd StructNodeDependency) DependencyPort() string

func (StructNodeDependency) Name

func (snd StructNodeDependency) Name() string

type StructNodeOutput

type StructNodeOutput[T any, G StructNodeProcesor[T]] struct {
	Struct *StructNode[T, G]
	Name   string
}

func (StructNodeOutput[T, G]) Node

func (sno StructNodeOutput[T, G]) Node() Node

func (StructNodeOutput[T, G]) Port added in v0.11.0

func (sno StructNodeOutput[T, G]) Port() string

func (StructNodeOutput[T, G]) Value added in v0.11.0

func (sno StructNodeOutput[T, G]) Value() T

type StructNodeProcesor

type StructNodeProcesor[T any] interface {
	Process() (T, error)
}

type Subscribable

type Subscribable interface {
	AddSubscription(a Alertable)
}

type SumData added in v0.11.0

type SumData[T vector.Number] struct {
	Values []NodeOutput[T]
}

func (SumData[T]) Process added in v0.11.0

func (cn SumData[T]) Process() (T, error)

type SumNode added in v0.11.0

type SumNode = StructNode[float64, SumData[float64]]

============================================================================

type Typed added in v0.11.0

type Typed interface {
	Type() string
}

type ValueNode

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

func FuncValue

func FuncValue[T any](f func() T) *ValueNode[T]

func Value

func Value[T any](startingValue T) *ValueNode[T]

func (*ValueNode[T]) AddSubscription

func (v *ValueNode[T]) AddSubscription(a Alertable)

func (*ValueNode[T]) Dependencies

func (v *ValueNode[T]) Dependencies() []NodeDependency

func (ValueNode[T]) Inputs added in v0.11.0

func (tn ValueNode[T]) Inputs() []Input

func (ValueNode[T]) Name

func (in ValueNode[T]) Name() string

func (*ValueNode[T]) Node

func (in *ValueNode[T]) Node() Node

func (*ValueNode[T]) Out added in v0.11.0

func (in *ValueNode[T]) Out() ValueNodeOutput[T]

func (*ValueNode[T]) Outputs added in v0.11.0

func (tn *ValueNode[T]) Outputs() []Output

func (*ValueNode[T]) Port added in v0.11.0

func (in *ValueNode[T]) Port() string

func (*ValueNode[T]) Set

func (in *ValueNode[T]) Set(value T)

func (ValueNode[T]) SetInput added in v0.11.0

func (vn ValueNode[T]) SetInput(input string, output Output)

func (*ValueNode[T]) State

func (v *ValueNode[T]) State() NodeState

func (ValueNode[T]) Value added in v0.11.0

func (in ValueNode[T]) Value() T

type ValueNodeOutput added in v0.11.0

type ValueNodeOutput[T any] struct {
	Val *ValueNode[T]
}

func (ValueNodeOutput[T]) Node added in v0.11.0

func (sno ValueNodeOutput[T]) Node() Node

func (ValueNodeOutput[T]) Port added in v0.11.0

func (sno ValueNodeOutput[T]) Port() string

func (ValueNodeOutput[T]) Value added in v0.11.0

func (sno ValueNodeOutput[T]) Value() T

type VersionData

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

func (*VersionData) Increment

func (v *VersionData) Increment() int

func (VersionData) Version

func (v VersionData) Version() int

type Versioned

type Versioned interface {
	Version() int
}

Directories

Path Synopsis
vecn

Jump to

Keyboard shortcuts

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