1 package gov.nasa.jpf.search.heuristic; 20 21 import gov.nasa.jpf.Config; 22 import gov.nasa.jpf.util.CoverageManager; 23 24 25 28 public class SumGlobalBranchCoverage implements Heuristic { 29 private int old = 1; 30 HeuristicSearch search; 31 32 public SumGlobalBranchCoverage (Config conig, HeuristicSearch search) { 33 this.search = search; 34 search.setCalcBranchCoverage(true); 35 } 36 37 public int heuristicValue () { 38 int li = CoverageManager.getLastIncrementedGlobal(); 39 40 if (li > 0) { 41 return li + old; 42 } else if (li == 0) { 43 if (old > 0) { 44 return old - 1; 45 } else { 46 return 0; 47 } 48 } else { 49 return old; 50 } 51 } 52 53 public void processParent () { 54 old = search.getOld().getPriority(); 55 } 56 } | Popular Tags |