tree

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatExample

func CatExample(fs embed.FS, src string) (buf []byte, err error)

func LsExamples

func LsExamples(fs embed.FS) (out string)

func Recalc added in v0.6.0

func Recalc(roots []*Ast, now time.Time, warn Warn)

func ToDot

func ToDot(roots []*Ast, warn Warn) (buf []byte)

Types

type Ast

type Ast struct {
	Name     string
	Desc     string
	Repeat   int
	Prob     float64
	FinRate  float64
	ReRate   float64
	Period   Stats
	Node     Stats
	Path     Stats
	Expected Stats
	Start    time.Time
	End      time.Time
	Due      time.Time
	Timeline fin.Timeline
	Parent   *Ast
	Children map[string]*Ast
}

func FromYAML

func FromYAML(buf []byte) (roots []*Ast, err error)

func (*Ast) Backward

func (this *Ast) Backward(warn Warn)

calculate .Expected.*

func (*Ast) Dot

func (a *Ast) Dot(graph *cgraph.Graph, loMirr, hiMirr float64, warn Warn) (gvparent *cgraph.Node, err error)

Dot adds a record-shaped node to the graphviz graph for Ast node p (parent), and adds a graphviz edge from p to each of the children of p.

func (*Ast) Forward

func (this *Ast) Forward(parent *Ast, now time.Time, warn Warn)

calculate .Path.*

type Node

type Node struct {
	Desc    string
	Cash    string
	Days    string
	Repeat  string
	FinRate float64
	ReRate  float64
	Due     time.Time
	Paths   Paths `yaml:",omitempty"`
}

type Nodes

type Nodes map[string]Node

func (Nodes) RootNodes

func (nodes Nodes) RootNodes() (rootnodes Nodes)

RootNode returns a map of all root nodes.

func (Nodes) ToAst

func (nodes Nodes) ToAst() (roots []*Ast)

func (Nodes) ToYAML added in v0.6.0

func (nodes Nodes) ToYAML() (buf []byte, err error)

type Paths

type Paths map[string]float64

type Stats

type Stats struct {
	Duration time.Duration
	Cash     float64
	Npv      float64
	Mirr     float64
}

type Warn

type Warn func(args ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳