package org.zenger.keco.adapt;

public class Statistics {
    private static long moduleInits;
    private static long accessCalls;
    private static long classFieldInst;
    private static long typeCasts;
    private static long typeTests;
    
    public static void moduleInit() {
        ++moduleInits;
    }
    
    public static void accessCall() {
        ++accessCalls;
    }
    
    public static void classFieldInst() {
        ++classFieldInst;
    }
    
    public static void typeCast() {
        ++typeCasts;
        --typeTests;
    }
    
    public static void typeTest() {
        ++typeTests;
    }
    
    public static void printStatistics() {
        if (moduleInits > 0) {
            System.out.println("# " + moduleInits + " modules instantiated");
            System.out.println("# " + accessCalls + " $access calls executed");
            System.out.println("# " + classFieldInst + " class fields instantiated");
            System.out.println("# " + typeCasts + " type casts");
            System.out.println("# " + typeTests + " type tests");
        }
    }
}
