/** * Replaces the node at the specified index, firing all the required * notifications. */ private void replaceAndDetachNode(int sourceIndex, List<Node<E>> nodesToVerify) { Node<E> node = data.get(sourceIndex, REAL_NODES).get(); Node<E> replacement = new Node<E>(node.virtual, new ArrayList<E>(node.path())); replaceNode(node, replacement, true); nodesToVerify.add(replacement); }
/** * Remove the node at the specified index, firing all the required * notifications. */ private void deleteAndDetachNode(int sourceIndex, List<Node<E>> nodesToVerify) { Node<E> node = data.get(sourceIndex, REAL_NODES).get(); // if it has children, replace it with a virtual copy and schedule that for verification if(!node.isLeaf()) { Node<E> replacement = new Node<E>(node.virtual, new ArrayList<E>(node.path())); replaceNode(node, replacement, true); nodesToVerify.add(replacement); // otherwise delete it directly } else { Node<E> follower = node.next(); deleteNode(node); // remove the parent if necessary in the next iteration nodesToVerify.add(node.parent); // also remove the follower - it may have become redundant as well if(follower != null && follower.virtual) nodesToVerify.add(follower); } }
/** * Remove the node at the specified index, firing all the required * notifications. */ private void deleteAndDetachNode(int sourceIndex, List<Node<E>> nodesToVerify) { Node<E> node = data.get(sourceIndex, REAL_NODES).get(); // if it has children, replace it with a virtual copy and schedule that for verification if(!node.isLeaf()) { Node<E> replacement = new Node<E>(node.virtual, new ArrayList<E>(node.path())); replaceNode(node, replacement, true); nodesToVerify.add(replacement); // otherwise delete it directly } else { Node<E> follower = node.next(); deleteNode(node); // remove the parent if necessary in the next iteration nodesToVerify.add(node.parent); // also remove the follower - it may have become redundant as well if(follower != null && follower.virtual) nodesToVerify.add(follower); } }
/** * Remove the node at the specified index, firing all the required * notifications. */ private void deleteAndDetachNode(int sourceIndex, List<Node<E>> nodesToVerify) { Node<E> node = data.get(sourceIndex, REAL_NODES).get(); // if it has children, replace it with a virtual copy and schedule that for verification if(!node.isLeaf()) { Node<E> replacement = new Node<E>(node.virtual, new ArrayList<E>(node.path())); replaceNode(node, replacement, true); nodesToVerify.add(replacement); // otherwise delete it directly } else { Node<E> follower = node.next(); deleteNode(node); // remove the parent if necessary in the next iteration nodesToVerify.add(node.parent); // also remove the follower - it may have become redundant as well if(follower != null && follower.virtual) nodesToVerify.add(follower); } }