/** * Create a {@link Node} that resembles the parent of this. */ private Node<E> describeParent() { int pathLength = pathLength(); // this is a root node, it has no parent if(pathLength == 1) return null; // return a node describing the parent path return new Node<E>(true, new ArrayList<E>(path.subList(0, pathLength - 1))); }
/** * Create a {@link Node} that resembles the parent of this. */ private Node<E> describeParent() { int pathLength = pathLength(); // this is a root node, it has no parent if(pathLength == 1) return null; // return a node describing the parent path return new Node<E>(true, new ArrayList<E>(path.subList(0, pathLength - 1))); }
/** * Create a {@link Node} that resembles the parent of this. */ private Node<E> describeParent() { int pathLength = pathLength(); // this is a root node, it has no parent if(pathLength == 1) return null; // return a node describing the parent path return new Node<E>(true, new ArrayList<E>(path.subList(0, pathLength - 1))); }
/** * 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); } }
/** * 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); }
public Node<E> evaluate(E sourceValue) { // populate the path using the working path as a temporary variable List<E> path = new ArrayList<E>(); format.getPath(path, sourceValue); Node<E> result = new Node<E>(false, path); result.expanded = expansionModel.isExpanded(sourceValue, path); return result; }
public Node<E> evaluate(E sourceValue) { // populate the path using the working path as a temporary variable List<E> path = new ArrayList<E>(); format.getPath(path, sourceValue); Node<E> result = new Node<E>(false, path); result.expanded = expansionModel.isExpanded(sourceValue, path); return result; }
@Override public Node<E> evaluate(E sourceValue) { // populate the path using the working path as a temporary variable List<E> path = new ArrayList<E>(); format.getPath(path, sourceValue); Node<E> result = new Node<E>(false, path); result.expanded = expansionModel.isExpanded(sourceValue, path); return result; }