1 package gov.nasa.jpf.search.heuristic; 20 21 import gov.nasa.jpf.Config; 22 import gov.nasa.jpf.VM; 23 import gov.nasa.jpf.jvm.TrailInfo; 24 25 26 33 public class PreferThreads implements Heuristic { 34 VM vm; 35 String [] preferredThreads; 36 37 public PreferThreads (Config config, HeuristicSearch hSearch) { 38 vm = hSearch.getVM(); 39 preferredThreads = config.getStringArray("search.heuristic.preferredThreads"); 40 } 41 42 public int heuristicValue () { 43 TrailInfo t = (TrailInfo) vm.getLastTransition(); 44 45 if (t == null) { 46 return 1; 47 } 48 49 String tn = vm.getThreadName(); 50 51 for (int i = 0; i < preferredThreads.length; i++) { 52 if (tn.equals(preferredThreads[i])) { 53 return 0; 54 } 55 } 56 57 return 1; 58 } 59 60 public void processParent () { 61 } 62 } 63 | Popular Tags |