class AllSuperTypes {

	public static Set<DataType> run(DataType t, boolean itself) {
		Ensure.not_null(t);
		
		Set<DataType> pending = new HashSet<>();
		pending.add(t);
		Set<DataType> result = new HashSet<>();
		if (itself) {
			result.add(t);
		}
		
		while (pending.size() > 0) {
			DataType dt = pending.iterator().next();
			pending.remove(dt);
			
			Set<DataType> pending_super = dt.super_types();
			result.addAll(pending_super);
			pending.addAll(pending_super);
		}
		
		return result;
	}

	private  AllSuperTypes();

}