@Test public void no_super_types_no_itself() throws Exception { TestDataType t1 = new TestDataType("x"); Set<DataType> r = AllSuperTypes.run(t1, false); assertEquals(0, r.size()); }
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; }
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; } }
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(); }
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(); static Set<DataType> run(DataType t, boolean itself); }
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(); static Set<DataType> run(DataType t, boolean itself);  }