Connect box 'b' to this box. b is now a child of this box, this box is now a parent of 'b'
(Box b)
| 119 | |
| 120 | /** |
| 121 | * Connect box 'b' to this box. b is now a child of this box, this box is now a parent of 'b' |
| 122 | */ |
| 123 | public Box connect(Box b) { |
| 124 | if (children.add(b)) all.addLast(b); |
| 125 | else { |
| 126 | // restore ordering to LinkedHashSet |
| 127 | children.remove(b); |
| 128 | children.add(b); |
| 129 | } |
| 130 | |
| 131 | if (b.parents.add(this)) b.all.addFirst(this); |
| 132 | else { |
| 133 | // restore ordering to LinkedHashSet |
| 134 | b.parents.remove(this); |
| 135 | b.parents.add(this); |
| 136 | } |
| 137 | |
| 138 | return this; |
| 139 | } |
| 140 |
no test coverage detected