class CommonLowerSuperTypes {

	public static Set<DataType> run(DataType t1, DataType t2, 
			boolean include_base) {
		Ensure.not_null(t1);
		Ensure.not_null(t2);
		
		Set<DataType> super_1 = AllSuperTypes.run(t1, include_base);
		Set<DataType> super_2 = AllSuperTypes.run(t2, include_base);
		
		Set<DataType> common = new HashSet<>(super_1);
		common.retainAll(super_2);
		
		for (DataType t : new HashSet<>(common)) {
			boolean is_super_of_any = false;
			for (DataType c : common) {
				if (t.super_of(c)) {
					is_super_of_any = true;
					break;
				}
			}
			
			if (is_super_of_any) {
				common.remove(t);
			}
		}
		return common;
	}

	private  CommonLowerSuperTypes();

}