/*******************************************************************************
* Copyright (c)                                                                *
*           2005   Tristan Allwood,                                            *
*           2005   Daniel Burke,                                               *
*           2005   Marc Hull,                                                  *
*           2005   Ekaterina Itskova,                                          *
*           2005   Steve Zymler                                                *
*                                                                              *
* Permission is hereby granted, free of charge, to any person obtaining a      *
* copy of this software and associated documentation files (the                *
* "Software"), to deal in the Software without restriction, including          *
* without limitation the rights to use, copy, modify, merge, publish,          *
* distribute, sublicense, and/or sell copies of the Software, and to           *
* permit persons to whom the Software is furnished to do so, subject to        *
* the following conditions:                                                    *
*                                                                              *
* The above copyright notice and this permission notice shall be included      *
* in all copies or substantial portions of the Software.                       *
*                                                                              *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS      *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                   *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.       *
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY         *
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,         *
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE            *
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                       *
*******************************************************************************/
package uk.ac.ic.doc.kevlar.core.framework.typecheck;

import java.util.Set;


/**
 * @author Steve Zymler
 * 
 * A representation of a ITypeTree This class and implementations must be
 * <b>immutable</b>.
 */
public interface ITypeTree 
{
	/**
	 * 
	 * @return the TypeTreeNode representing the root node.
	 */
	ITypeTreeNode getRootNode();

    /**
     * Check whether some type is in the type-tree here demonstrated.
     * 
     * @param alpha
     *            The Class to check
     * @return true if the class provided is in the type tree somewhere.
     */
    boolean isInTree(IInterfaceClass alpha);

    /**
     * Returns the least upper bound of a set of ITypeClass's
     * 
     * @param children
     * @return the IInterfaceClass which represents the least upper bound of all the
     *         children.
     *  
     */
    IInterfaceClass getLeastUpperBound(Set<IInterfaceClass> children);
    
    /**
     * Return the tree of types which has root as its root.
     * @param root The IInterfaceClass to use as a root.
     * @return ITypeTree which uses root as its root node.
     * @throws IllegalArgumentException if root is not in this type tree.
     */
    ITypeTree getSubTree(IInterfaceClass root);
    
    /**
     * 
     * @param typeClassA derived type to check
     * @param typeClassB superclass type to check 
     * @return true if typeClassA derives from typeClassB
     */
    boolean isDerivedFrom(IInterfaceClass typeClassA, IInterfaceClass typeClassB);
    
    
}
