Search in sources :

Example 1 with FileStatistics

use of com.cburch.logisim.file.FileStatistics in project logisim-evolution by reds-heig.

the class TtyInterface method displayStatistics.

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();
        // OK
        System.out.printf(// OK
        fmtNormal, Integer.valueOf(count.getUniqueCount()), Integer.valueOf(count.getRecursiveCount()), count.getFactory().getDisplayName(), libName);
    }
    FileStatistics.Count totalWithout = stats.getTotalWithoutSubcircuits();
    System.out.printf(// OK
    fmt + "%s\n", Integer.valueOf(totalWithout.getUniqueCount()), Integer.valueOf(totalWithout.getRecursiveCount()), Strings.get("statsTotalWithout"));
    System.out.printf(// OK
    fmt + "%s\n", Integer.valueOf(total.getUniqueCount()), Integer.valueOf(total.getRecursiveCount()), Strings.get("statsTotalWith"));
}
Also used : FileStatistics(com.cburch.logisim.file.FileStatistics) Library(com.cburch.logisim.tools.Library)

Example 2 with FileStatistics

use of com.cburch.logisim.file.FileStatistics in project logisim-evolution by reds-heig.

the class StatisticsDialog method show.

public static void show(JFrame parent, LogisimFile file, Circuit circuit) {
    FileStatistics stats = FileStatistics.compute(file, circuit);
    StatisticsDialog dlog = new StatisticsDialog(parent, circuit.getName(), new StatisticsTableModel(stats));
    dlog.setVisible(true);
}
Also used : FileStatistics(com.cburch.logisim.file.FileStatistics)

Aggregations

FileStatistics (com.cburch.logisim.file.FileStatistics)2 Library (com.cburch.logisim.tools.Library)1