@Override public TreeNode remove(int index) { TreeNode node = get(index); node.setParent(null); super.remove(index); updateRowKeys(parent); return node; }
@Override public TreeNode set(int index, TreeNode node) { if (node == null) { throw new NullPointerException(); } else if ((index < 0) || (index >= size())) { throw new IndexOutOfBoundsException(); } else { if (!parent.equals(node.getParent())) { eraseParent(node); } TreeNode previous = get(index); super.set(index, node); previous.setParent(null); node.setParent(parent); updateRowKeys(parent); return previous; } }
/** * Optimized set implementation to be used in sorting * * @param index index of the element to replace * @param node node to be stored at the specified position * @return the node previously at the specified position */ @Override public TreeNode setSibling(int index, TreeNode node) { if (node == null) { throw new NullPointerException(); } else if ((index < 0) || (index >= size())) { throw new IndexOutOfBoundsException(); } else { if (!parent.equals(node.getParent())) { eraseParent(node); } TreeNode previous = get(index); super.set(index, node); node.setParent(parent); updateRowKeys(parent); return previous; } }
@Override public TreeNode remove(int index) { TreeNode node = get(index); node.setParent(null); super.remove(index); updateRowKeys(parent); return node; }
/** * Optimized set implementation to be used in sorting * * @param index index of the element to replace * @param node node to be stored at the specified position * @return the node previously at the specified position */ public TreeNode setSibling(int index, TreeNode node) { if (node == null) { throw new NullPointerException(); } else if ((index < 0) || (index >= size())) { throw new IndexOutOfBoundsException(); } else { if (!parent.equals(node.getParent())) { eraseParent(node); } TreeNode previous = get(index); super.set(index, node); node.setParent(parent); updateRowKeys(parent); return previous; } }
@Override public TreeNode set(int index, TreeNode node) { if (node == null) { throw new NullPointerException(); } else if ((index < 0) || (index >= size())) { throw new IndexOutOfBoundsException(); } else { if (!parent.equals(node.getParent())) { eraseParent(node); } TreeNode previous = get(index); super.set(index, node); previous.setParent(null); node.setParent(parent); updateRowKeys(parent); return previous; } }