Copy returns a value copy of the Nodes.
()
| 26 | |
| 27 | // Copy returns a value copy of the Nodes. |
| 28 | func (n NodeSet) Copy() NodeSet { |
| 29 | result := ps.NewMap() |
| 30 | n.ForEach(func(node Node) { |
| 31 | result = result.UnsafeMutableSet(node.ID, node) |
| 32 | }) |
| 33 | return NodeSet{result} |
| 34 | } |
| 35 | |
| 36 | // UnsafeAdd adds a node to the NodeSet. Only call this if n has one owner. |
| 37 | func (n *NodeSet) UnsafeAdd(node Node) { |