class InterProceduralControlFlowDistanceCalculator extends ControlFlowDistanceCalculator {

    protected static ControlFlowDistance getNonRootDistance( ExecutionResult result,
                                                            Branch branch, boolean value) {

        if (branch == null){
            throw new IllegalStateException(
                    "expect this method only to be called if this goal does not try to cover the root branch");
        }


        String className = branch.getClassName();
        String methodName = branch.getMethodName();


        ControlFlowDistance r = new ControlFlowDistance();
//        if(isIntegration){
            r.setApproachLevel(GraphPool.getInstance(BotsingTestGenerationContext.getInstance().getClassLoaderForSUT()).getActualCFG("IntegrationTestingGraph","methodsIntegration").getDiameter() + 1);
//        }else{
//            r.setApproachLevel(branch.getInstruction().getActualCFG().getDiameter() + 1);
//        }

//
        // Currently r is in the worst state (r set to MAX)

        // Minimal distance between target node and path
        for (MethodCall call : result.getTrace().getMethodCalls()) {
            // This loop is for all of the observed calls in the trace of the generated test execution.
                ControlFlowDistance d2;
                Set<Branch> handled = new HashSet<Branch>();
                d2 = getNonRootDistance(result, call, branch, value, className, methodName, handled);
                // if d2 is better than r
                if (d2.compareTo(r) < 0) {
                    r = d2;
                }
        }

        return r;
    }

}