()
| 226 | } |
| 227 | |
| 228 | func (t *taskNodeImpl) Delete() { |
| 229 | parent := t.Parent().(*taskNodeImpl) |
| 230 | if parent == nil { |
| 231 | panic("can not delete root node") |
| 232 | } |
| 233 | for i := 0; i < parent.Len(); i++ { |
| 234 | if parent.At(i).Equal(t) { |
| 235 | parent.tasks = append(parent.tasks[:i], parent.tasks[i+1:]...) |
| 236 | t.parent = nil |
| 237 | return |
| 238 | } |
| 239 | } |
| 240 | panic("couldn't find t in parent in order to delete") |
| 241 | } |
| 242 | |
| 243 | type taskImpl struct { |
| 244 | *taskNodeImpl |