public static ImmutableList<Type<?>> insert(final ImmutableList<Type<?>> cl, final Type t) { if (cl.isEmpty() || precedes(t, cl.head)) { return cl.prepend(t); } else if (precedes(cl.head, t)) { return insert(cl.tail, t).prepend(cl.head); } else { return cl; } }
public static ImmutableList<Type<?>> insert(final ImmutableList<Type<?>> cl, final Type t) { if (cl.isEmpty() || precedes(t, cl.head)) { return cl.prepend(t); } else if (precedes(cl.head, t)) { return insert(cl.tail, t).prepend(cl.head); } else { return cl; } }
public static ImmutableList<Type<?>> insert(final ImmutableList<Type<?>> cl, final Type t) { if (cl.isEmpty() || precedes(t, cl.head)) { return cl.prepend(t); } else if (precedes(cl.head, t)) { return insert(cl.tail, t).prepend(cl.head); } else { 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; }
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; }