use of abs.frontend.ast.HasTypeHierarchy in project abstools by abstools.
the class TypeHierarchyContentProvider method getChildren.
@Override
public Object[] getChildren(Object node) {
if (node instanceof InterfaceDecl) {
InterfaceDecl interfaceDecl = (InterfaceDecl) node;
Collection<HasTypeHierarchy> subTypes = interfaceDecl.getDirectSubTypes();
return subTypes.toArray();
} else if (node instanceof DataTypeDecl) {
DataTypeDecl dataTypeDecl = (DataTypeDecl) node;
Object[] result = new Object[dataTypeDecl.getNumDataConstructor()];
int i = 0;
for (DataConstructor d : dataTypeDecl.getDataConstructors()) {
result[i] = d;
i++;
}
return result;
} else if (node instanceof TypeSynDecl) {
TypeSynDecl typeSynDecl = (TypeSynDecl) node;
return new Object[] { typeSynDecl.getType().getDecl() };
}
return nothing;
}
Aggregations