Documentation
¶
Index ¶
- func Fmap(f func(*TreeNode), root *TreeNode)
- type TreeNode
- func (n *TreeNode) Copy() *TreeNode
- func (n *TreeNode) HasChild(crd *coord.Coord, col color.Color) (int, bool)
- func (n *TreeNode) MaxDepth() int
- func (n *TreeNode) RecomputeDepth()
- func (n *TreeNode) SetDiff(diff *coord.Diff)
- func (n *TreeNode) SetParent(up *TreeNode)
- func (n *TreeNode) ShallowEqual(m *TreeNode) bool
- func (n *TreeNode) TrunkNum(i int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fmap ¶
Fmap applies a function f to every node under (and including) root even thought State contains Nodes and we can range over all the nodes, Fmap is useful for two reasons:
- it applies the function to the nodes in a consistent and hierarchical order
- it can be applied to a branch only, just supply it with a starting node that isn't the root
Types ¶
type TreeNode ¶
type TreeNode struct {
XY *coord.Coord
Color color.Color
Down []*TreeNode
Up *TreeNode
Index int
PreferredChild int
fields.Fields
Diff *coord.Diff
Depth int
BlackCaps int
WhiteCaps int
}
func NewTreeNode ¶
func (*TreeNode) RecomputeDepth ¶
func (n *TreeNode) RecomputeDepth()
RecomputeDepth is used when grafting, to make sure the depth is set correctly for all lower nodes
func (*TreeNode) ShallowEqual ¶
Click to show internal directories.
Click to hide internal directories.