(nLeft, nRight *Node)
| 77 | } |
| 78 | |
| 79 | func (g *GraphItem) AddEdge(nLeft, nRight *Node) { |
| 80 | g.lock() |
| 81 | if g.depends == nil { |
| 82 | g.depends = make(map[string][]*Node) |
| 83 | g.usedBy = make(map[string][]*Node) |
| 84 | } |
| 85 | if !contains(g.depends[nLeft.Value], nRight) { |
| 86 | g.depends[nLeft.Value] = append(g.depends[nLeft.Value], nRight) |
| 87 | } |
| 88 | if !contains(g.usedBy[nRight.Value], nLeft) { |
| 89 | g.usedBy[nRight.Value] = append(g.usedBy[nRight.Value], nLeft) |
| 90 | } |
| 91 | g.unlock() |
| 92 | } |
| 93 | |
| 94 | func (g *GraphItem) String() { |
| 95 | g.lock() |