int simCode = runSimulation(circState, outputPins, haltPin, ttyFormat);
System.exit(simCode);
}
private static void displayStatistics(LogisimFile file) {
FileStatistics stats = FileStatistics.compute(file, file.getMainCircuit());
FileStatistics.Count total = stats.getTotalWithSubcircuits();
int maxName = 0;
for (FileStatistics.Count count : stats.getCounts()) {
int nameLength = count.getFactory().getDisplayName().length();
if (nameLength > maxName) maxName = nameLength;
}
String fmt = "%" + countDigits(total.getUniqueCount()) + "d\t"
+ "%" + countDigits(total.getRecursiveCount()) + "d\t";
String fmtNormal = fmt + "%-" + maxName + "s\t%s\n";
for (FileStatistics.Count count : stats.getCounts()) {
Library lib = count.getLibrary();
String libName = lib == null ? "-" : lib.getDisplayName();
System.out.printf(fmtNormal, //OK
Integer.valueOf(count.getUniqueCount()),
Integer.valueOf(count.getRecursiveCount()),
count.getFactory().getDisplayName(), libName);
}
FileStatistics.Count totalWithout = stats.getTotalWithoutSubcircuits();
System.out.printf(fmt + "%s\n", //OK
Integer.valueOf(totalWithout.getUniqueCount()),
Integer.valueOf(totalWithout.getRecursiveCount()),
Strings.get("statsTotalWithout"));
System.out.printf(fmt + "%s\n", //OK