node

package
v0.0.0-...-5bd926f Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEdge

func NewEdge(from *Port, to *Port)

NewEdge creates a new edge between two ports

Types

type Edge

type Edge struct {
	From    *Port
	To      *Port
	Channel chan interface{}
}

func (*Edge) Propagate

func (e *Edge) Propagate(val interface{})

Propagates the value from the start to the end of the edge

type Location

type Location struct {
	X int
	Y int
}

type Node

type Node interface {
	Solve()
	GetInputs() []Port
	GetOutputs() []Port
	GetInput(i int) *Port
	GetOutput(i int) *Port
	GetId() string
	GetPosition() Location
	Init(c chan Result, id string)
}

type Port

type Port struct {
	Parent   Node
	Name     string
	Type     reflect.Kind
	HasValue bool

	Outgoing      []Edge
	Incoming      []*Edge
	Optional      bool
	ResultChannel chan Result
	// contains filtered or unexported fields
}

Generic Port Interface

func NewPort

func NewPort(parent Node, name string, kind reflect.Kind, c chan Result) Port

NewPort creates a new port

func (*Port) AddIncomingEdge

func (p *Port) AddIncomingEdge(e *Edge)

AddIncomingEdge adds and edge to a port as incoming

func (*Port) AddOutgoingEdge

func (p *Port) AddOutgoingEdge(e Edge)

AddOutgoingEdge adds an edge to a port as outgoing

func (*Port) AwaitValue

func (p *Port) AwaitValue() interface{}

AwaitValue awaits the value of a channel

func (*Port) GetIncomingChannel

func (p *Port) GetIncomingChannel(edge int) (error, chan interface{})

GetIncomingChannel gets an incoming channel for a specific edge

func (*Port) GetIncomingEdges

func (p *Port) GetIncomingEdges() []*Edge

GetIncomingEdges returns all incoming edges

func (*Port) GetValue

func (p *Port) GetValue() interface{}

GetValue returns the ports value

func (*Port) SetValue

func (p *Port) SetValue(val interface{})

SetValue sets a ports value and propagates it down the line

type Result

type Result struct {
	Id    string
	Port  string
	Value interface{}
}

Jump to

Keyboard shortcuts

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