use of com.jopdesign.dfa.framework.AnalysisResultSerialization in project jop by jop-devel.
the class DFATool method dumpDFA.
public String dumpDFA(MethodInfo method) {
if (getLoopBounds() == null)
return "n/a";
if (method.isAbstract()) {
return "n/a";
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream os = new PrintStream(baos);
Map<InstructionHandle, ContextMap<CallString, Pair<ValueMapping, ValueMapping>>> results = getLoopBounds().getResult();
if (results == null)
return "n/a";
AnalysisResultSerialization<Pair<ValueMapping, ValueMapping>> printer = new AnalysisResultSerialization<Pair<ValueMapping, ValueMapping>>();
for (Entry<InstructionHandle, ContextMap<CallString, Pair<ValueMapping, ValueMapping>>> ihEntry : results.entrySet()) {
for (Entry<CallString, Pair<ValueMapping, ValueMapping>> csEntry : ihEntry.getValue().entrySet()) {
if (ihEntry.getValue().getContext().getMethodInfo().equals(method)) {
printer.addResult(method, ihEntry.getKey().getPosition(), csEntry.getKey(), csEntry.getValue());
}
}
}
printer.dump(os);
try {
return baos.toString("UTF-8");
} catch (UnsupportedEncodingException e) {
return baos.toString();
}
}
Aggregations