/** * Implements IterationStrategyNode */ public final synchronized void setParent(MutableTreeNode newParent) { if (newParent != null && !(newParent instanceof IterationStrategyNode)) { throw new IllegalArgumentException( "Parent not a IterationStrategyNode instance: " + newParent); } if (newParent != null && !newParent.getAllowsChildren()) { throw new IllegalStateException( "New parent does not allow children"); } if (newParent == this) { throw new IllegalArgumentException("Can't be it's own parent"); } removeFromParent(); parent = (IterationStrategyNode) newParent; if (parent != null) { if (!parent.getChildren().contains(this)) { parent.insert(this); } } }
/** * Implements IterationStrategyNode */ public final synchronized void setParent(MutableTreeNode newParent) { if (newParent != null && !(newParent instanceof IterationStrategyNode)) { throw new IllegalArgumentException( "Parent not a IterationStrategyNode instance: " + newParent); } if (newParent != null && !newParent.getAllowsChildren()) { throw new IllegalStateException( "New parent does not allow children"); } if (newParent == this) { throw new IllegalArgumentException("Can't be it's own parent"); } removeFromParent(); parent = (IterationStrategyNode) newParent; if (parent != null) { if (!parent.getChildren().contains(this)) { parent.insert(this); } } }