AppendChild 添加子依赖
(child *DepGraph)
| 38 | |
| 39 | // AppendChild 添加子依赖 |
| 40 | func (dep *DepGraph) AppendChild(child *DepGraph) { |
| 41 | if dep == nil || child == nil { |
| 42 | return |
| 43 | } |
| 44 | if dep.cset == nil { |
| 45 | dep.cset = map[*DepGraph]bool{} |
| 46 | } |
| 47 | if child.pset == nil { |
| 48 | child.pset = map[*DepGraph]bool{} |
| 49 | } |
| 50 | if !dep.cset[child] { |
| 51 | dep.Children = append(dep.Children, child) |
| 52 | dep.cset[child] = true |
| 53 | } |
| 54 | if !child.pset[dep] { |
| 55 | child.Parents = append(child.Parents, dep) |
| 56 | child.pset[dep] = true |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // RemoveChild 移除子依赖 |
| 61 | func (dep *DepGraph) RemoveChild(child *DepGraph) { |
no outgoing calls
no test coverage detected