()
| 186 | } |
| 187 | |
| 188 | public void remove() { |
| 189 | if (! canRemove) throw new IllegalStateException(); |
| 190 | |
| 191 | if (prevPrevCell != null && prevPrevCell.next == prevCell) { |
| 192 | // cell to remove is not the first in the list. |
| 193 | prevPrevCell.next = prevCell.next; |
| 194 | prevCell = prevPrevCell; |
| 195 | } else if (prevCell.next == cell && cell != null) { |
| 196 | // cell to remove is the first in the list, but not the last. |
| 197 | set = (PersistentSet) path.replaceWith(cell); |
| 198 | prevCell = null; |
| 199 | } else { |
| 200 | // cell is alone in the list. |
| 201 | set = (PersistentSet) path.remove(); |
| 202 | path = nextPath; |
| 203 | if (path != null) { |
| 204 | prevCell = null; |
| 205 | cell = path.value(); |
| 206 | path = (PersistentSet.Path) set.find((Cell) cell); |
| 207 | nextPath = nextPath(); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | canRemove = false; |
| 212 | } |
| 213 | } |
| 214 | } |
nothing calls this directly
no test coverage detected