// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/TreeForTreeLayout.java
// public interface TreeForTreeLayout<TreeNode> {
// 
// 	/**
// 	 * Returns the the root of the tree.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @return the root of the tree
// 	 */
// 	TreeNode getRoot();
// 
// 	/**
// 	 * Tells if a node is a leaf in the tree.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param node &nbsp;
// 	 * @return true iff node is a leaf in the tree, i.e. has no children.
// 	 */
// 	boolean isLeaf(TreeNode node);
// 
// 	/**
// 	 * Tells if a node is a child of a given parentNode.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param node &nbsp;
// 	 * @param parentNode &nbsp;
// 	 * @return true iff the node is a child of the given parentNode
// 	 */
// 	boolean isChildOfParent(TreeNode node, TreeNode parentNode);
// 
// 	/**
// 	 * Returns the children of a parent node.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the children of the given parentNode, from first to last
// 	 */
// 	Iterable<TreeNode> getChildren(TreeNode parentNode);
// 
// 	/**
// 	 * Returns the children of a parent node, in reverse order.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the children of given parentNode, from last to first
// 	 */
// 	Iterable<TreeNode> getChildrenReverse(TreeNode parentNode);
// 
// 	/**
// 	 * Returns the first child of a parent node.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the first child of the parentNode
// 	 */
// 	TreeNode getFirstChild(TreeNode parentNode);
// 
// 	/**
// 	 * Returns the last child of a parent node.
// 	 * <p>
// 	 * 
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the last child of the parentNode
// 	 */
// 	TreeNode getLastChild(TreeNode parentNode);
// }
// 
// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/IterableUtil.java
// public class IterableUtil {
// 	private static class ReverseIterable<T> implements Iterable<T> {
// 		private List<T> list;
// 
// 		public ReverseIterable(List<T> list) {
// 			this.list = list;
// 		}
// 
// 		@Override
// 		public Iterator<T> iterator() {
// 			return IteratorUtil.createReverseIterator(list);
// 		}
// 	};
// 
// 	/**
// 	 * Returns an {@link Iterable} with an iterator iterating the given list
// 	 * from the end to the start.
// 	 * <p>
// 	 * I.e. the iterator does the reverse of the {@link List#iterator()}.
// 	 * 
// 	 * @param <T> Type of elements in the list
// 	 * @param list  &nbsp;
// 	 * @return a reverse {@link Iterable} of the list
// 	 */
// 	public static <T> Iterable<T> createReverseIterable(List<T> list) {
// 		// When the list is empty we can use the "forward" iterable (i.e. the
// 		// list itself) also as the reverseIterable as it will do nothing.
// 		if (list.size() == 0) {
// 			return list;
// 		}
// 
// 		return new ReverseIterable<T>(list);
// 	}
// }
// 
// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/ListUtil.java
// public class ListUtil {
// 
// 	/**
// 	 * 
// 	 * @param <T> Type of elements in the list
// 	 * @param list [!list.isEmpty()]
// 	 * @return the last element of the list
// 	 */
// 	public static <T> T getLast(List<T> list) {
// 		return list.get(list.size() - 1);
// 	}
// 
// }


import org.abego.treelayout.TreeForTreeLayout;
import org.abego.treelayout.internal.util.java.lang.IterableUtil;
import org.abego.treelayout.internal.util.java.util.ListUtil;
import java.util.List;
		return root;
	}

	@Override
	public boolean isLeaf(TreeNode node) {
		return getChildrenList(node).isEmpty();
	}

	@Override
	public boolean isChildOfParent(TreeNode node, TreeNode parentNode) {
		return getParent(node) == parentNode;
	}

	@Override
	public Iterable<TreeNode> getChildren(TreeNode node) {
		return getChildrenList(node);
	}

	@Override
	public Iterable<TreeNode> getChildrenReverse(TreeNode node) {
		return IterableUtil.createReverseIterable(getChildrenList(node));
	}

	@Override
	public TreeNode getFirstChild(TreeNode parentNode) {
		return getChildrenList(parentNode).get(0);
	}

	@Override
	public TreeNode getLastChild(TreeNode parentNode) {
// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/TreeForTreeLayout.java
// public interface TreeForTreeLayout<TreeNode> {
// 
// 	/**
// 	 * Returns the the root of the tree.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @return the root of the tree
// 	 */
// 	TreeNode getRoot();
// 
// 	/**
// 	 * Tells if a node is a leaf in the tree.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param node &nbsp;
// 	 * @return true iff node is a leaf in the tree, i.e. has no children.
// 	 */
// 	boolean isLeaf(TreeNode node);
// 
// 	/**
// 	 * Tells if a node is a child of a given parentNode.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param node &nbsp;
// 	 * @param parentNode &nbsp;
// 	 * @return true iff the node is a child of the given parentNode
// 	 */
// 	boolean isChildOfParent(TreeNode node, TreeNode parentNode);
// 
// 	/**
// 	 * Returns the children of a parent node.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the children of the given parentNode, from first to last
// 	 */
// 	Iterable<TreeNode> getChildren(TreeNode parentNode);
// 
// 	/**
// 	 * Returns the children of a parent node, in reverse order.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the children of given parentNode, from last to first
// 	 */
// 	Iterable<TreeNode> getChildrenReverse(TreeNode parentNode);
// 
// 	/**
// 	 * Returns the first child of a parent node.
// 	 * <p>
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the first child of the parentNode
// 	 */
// 	TreeNode getFirstChild(TreeNode parentNode);
// 
// 	/**
// 	 * Returns the last child of a parent node.
// 	 * <p>
// 	 * 
// 	 * Time Complexity: O(1)
// 	 * 
// 	 * @param parentNode
// 	 *            [!isLeaf(parentNode)]
// 	 * @return the last child of the parentNode
// 	 */
// 	TreeNode getLastChild(TreeNode parentNode);
// }
// 
// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/IterableUtil.java
// public class IterableUtil {
// 	private static class ReverseIterable<T> implements Iterable<T> {
// 		private List<T> list;
// 
// 		public ReverseIterable(List<T> list) {
// 			this.list = list;
// 		}
// 
// 		@Override
// 		public Iterator<T> iterator() {
// 			return IteratorUtil.createReverseIterator(list);
// 		}
// 	};
// 
// 	/**
// 	 * Returns an {@link Iterable} with an iterator iterating the given list
// 	 * from the end to the start.
// 	 * <p>
// 	 * I.e. the iterator does the reverse of the {@link List#iterator()}.
// 	 * 
// 	 * @param <T> Type of elements in the list
// 	 * @param list  &nbsp;
// 	 * @return a reverse {@link Iterable} of the list
// 	 */
// 	public static <T> Iterable<T> createReverseIterable(List<T> list) {
// 		// When the list is empty we can use the "forward" iterable (i.e. the
// 		// list itself) also as the reverseIterable as it will do nothing.
// 		if (list.size() == 0) {
// 			return list;
// 		}
// 
// 		return new ReverseIterable<T>(list);
// 	}
// }
// 
// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/util/ListUtil.java
// public class ListUtil {
// 
// 	/**
// 	 * 
// 	 * @param <T> Type of elements in the list
// 	 * @param list [!list.isEmpty()]
// 	 * @return the last element of the list
// 	 */
// 	public static <T> T getLast(List<T> list) {
// 		return list.get(list.size() - 1);
// 	}
// 
// }


// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/util/AbstractTreeForTreeLayout.java
import org.abego.treelayout.TreeForTreeLayout;
import org.abego.treelayout.internal.util.java.lang.IterableUtil;
import org.abego.treelayout.internal.util.java.util.ListUtil;
import java.util.List;

		return root;
	}

	@Override
	public boolean isLeaf(TreeNode node) {
		return getChildrenList(node).isEmpty();
	}

	@Override
	public boolean isChildOfParent(TreeNode node, TreeNode parentNode) {
		return getParent(node) == parentNode;
	}

	@Override
	public Iterable<TreeNode> getChildren(TreeNode node) {
		return getChildrenList(node);
	}

	@Override
	public Iterable<TreeNode> getChildrenReverse(TreeNode node) {
		return IterableUtil.createReverseIterable(getChildrenList(node));
	}

	@Override
	public TreeNode getFirstChild(TreeNode parentNode) {
		return getChildrenList(parentNode).get(0);
	}

	@Override
	public TreeNode getLastChild(TreeNode parentNode) {
		return ListUtil.getLast(getChildrenList(parentNode));