public void moveTo(Criterion newParent) { if (parent == null) { if (newParent != null) { parent = newParent; parent.getChildren().add(this); } } else { // parent != null if (!parent.equals(newParent)) { parent.getChildren().remove(this); parent = newParent; if (parent != null) { parent.getChildren().add(this); } } } }