MCPcopy
hub / github.com/g3n/engine / Remove

Method Remove

core/node.go:417–430  ·  view source on GitHub ↗

Remove removes the specified INode from the list of children. Returns true if found or false otherwise.

(ichild INode)

Source from the content-addressed store, hash-verified

415// Remove removes the specified INode from the list of children.
416// Returns true if found or false otherwise.
417func (n *Node) Remove(ichild INode) bool {
418
419 for pos, current := range n.children {
420 if current == ichild {
421 copy(n.children[pos:], n.children[pos+1:])
422 n.children[len(n.children)-1] = nil
423 n.children = n.children[:len(n.children)-1]
424 ichild.GetNode().parent = nil
425 n.Dispatch(OnDescendant, nil)
426 return true
427 }
428 }
429 return false
430}
431
432// RemoveAt removes the child at the specified index.
433func (n *Node) RemoveAt(idx int) INode {

Callers 1

setParentFunction · 0.45

Calls 2

GetNodeMethod · 0.65
DispatchMethod · 0.65

Tested by

no test coverage detected