001/*-------------------------------------------------------------------------+
002|                                                                          |
003| Copyright 2005-2011 The ConQAT Project                                   |
004|                                                                          |
005| Licensed under the Apache License, Version 2.0 (the "License");          |
006| you may not use this file except in compliance with the License.         |
007| You may obtain a copy of the License at                                  |
008|                                                                          |
009|    http://www.apache.org/licenses/LICENSE-2.0                            |
010|                                                                          |
011| Unless required by applicable law or agreed to in writing, software      |
012| distributed under the License is distributed on an "AS IS" BASIS,        |
013| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
014| See the License for the specific language governing permissions and      |
015| limitations under the License.                                           |
016+-------------------------------------------------------------------------*/
017package org.conqat.lib.commons.visitor;
018
019import java.util.Collection;
020
021import org.conqat.lib.commons.error.NeverThrownRuntimeException;
022
023/**
024 * Interface for a tree walker, i.e. a class which allows the traversal of a
025 * tree. The implementor has to make sure, that this really is a tree, i.e. for
026 * two different node, the children returned must be disjunctive, and traversing
027 * the tree may not result in loops.
028 * 
029 * @param <T>
030 *            the type used for the nodes of the tree.
031 * @param <X>
032 *            the type of exception thrown. Use
033 *            {@link NeverThrownRuntimeException} if no exception is thrown
034 * 
035 * @author hummelb
036 */
037public interface ITreeWalker<T, X extends Exception> {
038
039        /**
040         * Returns the children of the given tree node. The returned collection may
041         * not contain duplicate entries.
042         */
043        public Collection<T> getChildren(T node) throws X;
044}