public static ImmutableList<Type<?>> union(final ImmutableList<Type<?>> cl1, final ImmutableList<Type<?>> cl2) { if (cl1.isEmpty()) { return cl2; } else if (cl2.isEmpty()) { return cl1; } else if (precedes(cl1.head, cl2.head)) { return union(cl1.tail, cl2).prepend(cl1.head); } else if (precedes(cl2.head, cl1.head)) { return union(cl1, cl2.tail).prepend(cl2.head); } else { return union(cl1.tail, cl2.tail).prepend(cl1.head); } }
public static ImmutableList<Type<?>> union(final ImmutableList<Type<?>> cl1, final ImmutableList<Type<?>> cl2) { if (cl1.isEmpty()) { return cl2; } else if (cl2.isEmpty()) { return cl1; } else if (precedes(cl1.head, cl2.head)) { return union(cl1.tail, cl2).prepend(cl1.head); } else if (precedes(cl2.head, cl1.head)) { return union(cl1, cl2.tail).prepend(cl2.head); } else { return union(cl1.tail, cl2.tail).prepend(cl1.head); } }
public static ImmutableList<Type<?>> union(final ImmutableList<Type<?>> cl1, final ImmutableList<Type<?>> cl2) { if (cl1.isEmpty()) { return cl2; } else if (cl2.isEmpty()) { return cl1; } else if (precedes(cl1.head, cl2.head)) { return union(cl1.tail, cl2).prepend(cl1.head); } else if (precedes(cl2.head, cl1.head)) { return union(cl1, cl2.tail).prepend(cl2.head); } else { return union(cl1.tail, cl2.tail).prepend(cl1.head); } }
@Override public ImmutableList<Type<?>> visitClassType(final Type<?> t, final ImmutableList<Type<?>> list) { final TypeList interfaces = t.getExplicitInterfaces(); if (interfaces.isEmpty()) { return ImmutableList.empty(); } ImmutableList<Type<?>> result = union(list, ImmutableList.from(t.getExplicitInterfaces().toArray())); for (final Type ifType : interfaces) { if (!list.contains(ifType)) { result = union(result, visit(ifType, result)); } } return result; }
@Override public ImmutableList<Type<?>> visitClassType(final Type<?> t, final ImmutableList<Type<?>> list) { final TypeList interfaces = t.getExplicitInterfaces(); if (interfaces.isEmpty()) { return ImmutableList.empty(); } ImmutableList<Type<?>> result = union(list, ImmutableList.from(t.getExplicitInterfaces().toArray())); for (final Type ifType : interfaces) { if (!list.contains(ifType)) { result = union(result, visit(ifType, result)); } } return result; }
@Override public ImmutableList<Type<?>> visitClassType(final Type<?> t, final ImmutableList<Type<?>> list) { final TypeList interfaces = t.getExplicitInterfaces(); if (interfaces.isEmpty()) { return ImmutableList.empty(); } ImmutableList<Type<?>> result = union(list, ImmutableList.from(t.getExplicitInterfaces().toArray())); for (final Type ifType : interfaces) { if (!list.contains(ifType)) { result = union(result, visit(ifType, result)); } } return result; }
public static ImmutableList<Type<?>> closure(final Type<?> t) { ImmutableList<Type<?>> cl = closureCache.get(t); if (cl == null) { final Type st = superType(t); if (!t.isCompoundType()) { if (st != null && st.getKind() == TypeKind.DECLARED) { cl = insert(closure(st), t); } else if (st != null && st.getKind() == TypeKind.TYPEVAR) { cl = closure(st).prepend(t); } else { cl = ImmutableList.<Type<?>>of(t); } } else { cl = closure(superType(t)); } for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { cl = union(cl, closure(l.head)); } closureCache.put(t, cl); } return cl; }
public static ImmutableList<Type<?>> closure(final Type<?> t) { ImmutableList<Type<?>> cl = closureCache.get(t); if (cl == null) { final Type st = superType(t); if (!t.isCompoundType()) { if (st != null && st.getKind() == TypeKind.DECLARED) { cl = insert(closure(st), t); } else if (st != null && st.getKind() == TypeKind.TYPEVAR) { cl = closure(st).prepend(t); } else { cl = ImmutableList.<Type<?>>of(t); } } else { cl = closure(superType(t)); } for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { cl = union(cl, closure(l.head)); } closureCache.put(t, cl); } return cl; }
public static ImmutableList<Type<?>> closure(final Type<?> t) { ImmutableList<Type<?>> cl = closureCache.get(t); if (cl == null) { final Type st = superType(t); if (!t.isCompoundType()) { if (st != null && st.getKind() == TypeKind.DECLARED) { cl = insert(closure(st), t); } else if (st != null && st.getKind() == TypeKind.TYPEVAR) { cl = closure(st).prepend(t); } else { cl = ImmutableList.<Type<?>>of(t); } } else { cl = closure(superType(t)); } for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { cl = union(cl, closure(l.head)); } closureCache.put(t, cl); } return cl; }
final ImmutableList<Type<?>> closure = union(closure(t), closure(p)); final ImmutableList<Type<?>> bounds = closureMin(closure);
final ImmutableList<Type<?>> closure = union(closure(t), closure(p)); final ImmutableList<Type<?>> bounds = closureMin(closure);
final ImmutableList<Type<?>> closure = union(closure(t), closure(p)); final ImmutableList<Type<?>> bounds = closureMin(closure);