use of org.mapleir.app.service.ClassTree.InheritanceEdge in project maple-ir by LLVM-but-worse.
the class ClassTree method addVertex.
@Override
public boolean addVertex(ClassNode cn) {
if (cn == null) {
LOGGER.error("Received null to ClassTree.addVertex");
return false;
}
if (!super.addVertex(cn))
return false;
if (cn != rootNode) {
Set<InheritanceEdge> edges = new HashSet<>();
ClassNode sup = cn.node.superName != null ? requestClass0(cn.node.superName, cn.getName()) : rootNode;
if (sup == null) {
LOGGER.error(String.format("No superclass %s for %s", cn.node.superName, cn.getName()));
removeVertex(cn);
return false;
}
edges.add(new ExtendsEdge(cn, sup));
for (String s : cn.node.interfaces) {
ClassNode iface = requestClass0(s, cn.getName());
if (iface == null) {
LOGGER.error(String.format("No superinterface %s for %s", s, cn.getName()));
removeVertex(cn);
return false;
}
edges.add(new ImplementsEdge(cn, iface));
}
for (InheritanceEdge e : edges) {
super.addEdge(e);
}
}
return true;
}
use of org.mapleir.app.service.ClassTree.InheritanceEdge in project maple-ir by LLVM-but-worse.
the class ClassTree method blockToString.
public static void blockToString(TabbedStringWriter sw, ClassTree ct, ClassNode cn) {
sw.print(String.format("%s", cn.getDisplayName()));
sw.tab();
for (InheritanceEdge e : ct.getEdges(cn)) {
sw.print("\n^ " + e.toString());
}
for (InheritanceEdge p : ct.getReverseEdges(cn)) {
sw.print("\nV " + p.toString());
}
sw.untab();
sw.print("\n");
}
Aggregations