Search in sources :

Example 1 with InterfaceType

use of abs.frontend.typechecker.InterfaceType in project abstools by abstools.

the class TypeHierarchyContentProvider method getElements.

@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof Type) {
        Type type = (Type) inputElement;
        if (type.getDecl() != null) {
            return new Object[] { type.getDecl() };
        }
        if (type instanceof UnionType) {
            UnionType unionType = (UnionType) type;
            java.util.List<Object> result = new ArrayList<Object>();
            for (InterfaceType t : unionType.getTypes()) {
                for (Object e : getElements(t)) {
                    result.add(e);
                }
            }
            return result.toArray();
        }
    }
    return nothing;
}
Also used : UnionType(abs.frontend.typechecker.UnionType) Type(abs.frontend.typechecker.Type) InterfaceType(abs.frontend.typechecker.InterfaceType) UnionType(abs.frontend.typechecker.UnionType) InterfaceType(abs.frontend.typechecker.InterfaceType) ArrayList(java.util.ArrayList)

Aggregations

InterfaceType (abs.frontend.typechecker.InterfaceType)1 Type (abs.frontend.typechecker.Type)1 UnionType (abs.frontend.typechecker.UnionType)1 ArrayList (java.util.ArrayList)1