예제 #1
0
    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);
                }
            }

        }

    }