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 SumPathBranchCoverage implements Heuristic { 29 private int old = 1; 30 HeuristicSearch search; 31 32 public SumPathBranchCoverage (Config config, HeuristicSearch search) { 33 search.setPathCoverage( true); 34 search.setCalcBranchCoverage(true); 35 36 this.search = search; 37 } 38 39 public int heuristicValue () { 40 int li = CoverageManager.getLastIncremented(); 41 42 if (li > 0) { 43 return li + old; 44 } else if (li == 0) { 45 if (old > 0) { 46 return old - 1; 47 } else { 48 return 0; 49 } 50 } else { 51 return old; 52 } 53 } 54 55 public void processParent () { 56 old = search.getOld().getPriority(); 57 } 58 } | Popular Tags |