public void remove(int index) { if (!getAllowsChildren()) { throw new IllegalStateException("Node does not allow children"); } children.remove(index); }
public void remove(int index) { if (!getAllowsChildren()) { throw new IllegalStateException("Node does not allow children"); } children.remove(index); }
public synchronized void remove(MutableTreeNode node) { if (!getAllowsChildren()) { throw new IllegalStateException("Node does not allow children"); } children.remove(node); if (node.getParent() == this) { node.setParent(null); } }
public synchronized void remove(MutableTreeNode node) { if (!getAllowsChildren()) { throw new IllegalStateException("Node does not allow children"); } children.remove(node); if (node.getParent() == this) { node.setParent(null); } }
public synchronized void insert(MutableTreeNode child, int index) { if (!getAllowsChildren()) { throw new IllegalStateException("Node does not allow children"); } if (!(child instanceof IterationStrategyNode)) { throw new IllegalArgumentException( "Child not an instance of IterationStrategyNode: " + child); } if (child == this) { throw new IllegalArgumentException("Can't be it's own parent"); } // Check if it is already there (in case we'll just move it) int alreadyExistsIndex = children.indexOf(child); children.add(index, (IterationStrategyNode) child); if (alreadyExistsIndex > -1) { // Remove it from the old position if (index < alreadyExistsIndex && alreadyExistsIndex + 1 < children.size()) { alreadyExistsIndex++; } children.remove(alreadyExistsIndex); } if (child.getParent() != this) { child.setParent(this); } }
public synchronized void insert(MutableTreeNode child, int index) { if (!getAllowsChildren()) { throw new IllegalStateException("Node does not allow children"); } if (!(child instanceof IterationStrategyNode)) { throw new IllegalArgumentException( "Child not an instance of IterationStrategyNode: " + child); } if (child == this) { throw new IllegalArgumentException("Can't be it's own parent"); } // Check if it is already there (in case we'll just move it) int alreadyExistsIndex = children.indexOf(child); children.add(index, (IterationStrategyNode) child); if (alreadyExistsIndex > -1) { // Remove it from the old position if (index < alreadyExistsIndex && alreadyExistsIndex + 1 < children.size()) { alreadyExistsIndex++; } children.remove(alreadyExistsIndex); } if (child.getParent() != this) { child.setParent(this); } }