本文整理匯總了Golang中github.com/axel-freesp/sge/interface/behaviour.NodeIf.AddToTree方法的典型用法代碼示例。如果您正苦於以下問題:Golang NodeIf.AddToTree方法的具體用法?Golang NodeIf.AddToTree怎麽用?Golang NodeIf.AddToTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/axel-freesp/sge/interface/behaviour.NodeIf
的用法示例。
在下文中一共展示了NodeIf.AddToTree方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: treeNewObject
func (t *nodeType) treeNewObject(tree tr.TreeIf, cursor tr.Cursor, obj tr.TreeElementIf) (newCursor tr.Cursor) {
switch obj.(type) {
case bh.ImplementationIf:
cursor.Position = len(t.Implementation()) - 1
newCursor = tree.Insert(cursor)
obj.(bh.ImplementationIf).AddToTree(tree, newCursor)
case bh.PortTypeIf:
pt := obj.(bh.PortTypeIf)
newCursor = tree.Insert(cursor)
pt.AddToTree(tree, newCursor)
for _, impl := range t.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
// bh.NodeIf linked to outer port
g := impl.Graph().(*signalGraphType)
var n bh.NodeIf
index := -len(t.Implementation())
if pt.Direction() == gr.InPort {
n = g.findInputNodeFromPortType(pt)
if cursor.Position == tr.AppendCursor {
index += len(g.InputNodes())
}
} else {
n = g.findOutputNodeFromPortType(pt)
if cursor.Position == tr.AppendCursor {
index += len(g.InputNodes()) + len(g.OutputNodes())
}
}
if n == nil {
log.Fatalf("nodeType.AddNewObject error: invalid implementation...\n")
}
if cursor.Position != tr.AppendCursor {
index += cursor.Position
}
gCursor := tree.CursorAt(cursor, impl)
gCursor.Position = index
n.AddToTree(tree, tree.Insert(gCursor))
}
}
default:
log.Fatalf("nodeType.AddNewObject error: invalid type %T\n", obj)
}
return
}
示例2: treeAddNewObject
func (t *signalGraphType) treeAddNewObject(tree tr.TreeIf, cursor tr.Cursor, n bh.NodeIf) (newCursor tr.Cursor) {
newCursor = tree.Insert(cursor)
n.AddToTree(tree, newCursor)
return
}