本文整理匯總了Golang中github.com/axel-freesp/sge/interface/behaviour.NodeIdIf.IsAncestor方法的典型用法代碼示例。如果您正苦於以下問題:Golang NodeIdIf.IsAncestor方法的具體用法?Golang NodeIdIf.IsAncestor怎麽用?Golang NodeIdIf.IsAncestor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/axel-freesp/sge/interface/behaviour.NodeIdIf
的用法示例。
在下文中一共展示了NodeIdIf.IsAncestor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SubNode
func (n *node) SubNode(ownId, childId bh.NodeIdIf) (ret bh.NodeIf, ok bool) {
log.Printf("node.SubNode(%s, %s)\n", ownId, childId)
if ownId.String() == childId.String() {
ret, ok = n, true
return
}
if !ownId.IsAncestor(childId) {
return
}
for _, chn := range n.children() {
ret, ok = chn.SubNode(NodeIdNew(ownId, chn.Name()), childId)
if ok {
return
}
}
return
}
示例2: SelectNode
func (n *ExpandedNode) SelectNode(ownId, selectId bh.NodeIdIf) (modified bool, node NodeIf) {
if ownId.String() == selectId.String() || ownId.IsAncestor(selectId) {
n.highlighted = true
node = n
modified = n.Select()
} else {
n.highlighted = false
modified = n.Deselect()
}
for _, ch := range n.Children {
nn := ch.(NodeIf)
chId := freesp.NodeIdNew(ownId, nn.Name())
m, nd := nn.SelectNode(chId, selectId)
if nd != nil {
node = nd
}
modified = modified || m
}
return
}