All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kuali.common.util.tree.ImmutableNode Maven / Gradle / Ivy

There is a newer version: 4.4.17
Show newest version
/**
 * Copyright 2010-2014 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.common.util.tree;

import static org.kuali.common.util.base.Precondition.checkNotNull;

import java.util.List;

public final class ImmutableNode extends MutableNode {

	private static final String UOE_MSG = "not supported for immutable node's";

	public static  ImmutableNode copyOf(Node node) {
		return new ImmutableNode(node);
	}

	public ImmutableNode(Node node) {
		checkNotNull(node, "node");
		super.setElement(node.getElement());
		List> children = node.getChildren();
		for (Node child : children) {
			super.add(children.size(), copyOf(child));
		}
	}

	@Override
	public void setElement(T element) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(List> children) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(MutableNode child1, MutableNode child2) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(MutableNode child1, MutableNode child2, MutableNode child3) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(MutableNode child1, MutableNode child2, MutableNode child3, MutableNode child4) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(MutableNode child1, MutableNode child2, MutableNode child3, MutableNode child4, MutableNode child5) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(MutableNode child) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void add(int index, MutableNode child) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void remove(MutableNode child) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void remove(int index) {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void removeAllChildren() {
		throw new UnsupportedOperationException(UOE_MSG);
	}

	@Override
	public void removeFromParent() {
		throw new UnsupportedOperationException(UOE_MSG);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy