001/*
002 * Forge Mod Loader
003 * Copyright (c) 2012-2013 cpw.
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser Public License v2.1
006 * which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
008 * 
009 * Contributors:
010 *     cpw - implementation
011 */
012
013package cpw.mods.fml.common.toposort;
014
015import java.util.Set;
016
017public class ModSortingException extends RuntimeException
018{
019    public class SortingExceptionData<T>
020    {
021        public SortingExceptionData(T node, Set<T> visitedNodes)
022        {
023            this.firstBadNode = node;
024            this.visitedNodes = visitedNodes;
025        }
026
027        private T firstBadNode;
028        private Set<T> visitedNodes;
029
030        public T getFirstBadNode()
031        {
032            return firstBadNode;
033        }
034        public Set<T> getVisitedNodes()
035        {
036            return visitedNodes;
037        }
038    }
039
040    private SortingExceptionData sortingExceptionData;
041
042    public <T> ModSortingException(String string, T node, Set<T> visitedNodes)
043    {
044        super(string);
045        this.sortingExceptionData = new SortingExceptionData(node, visitedNodes);
046    }
047
048    public <T> SortingExceptionData<T> getExceptionData()
049    {
050        return sortingExceptionData;
051    }
052
053}