1 package gov.nasa.jpf.search.heuristic; 20 21 import gov.nasa.jpf.VM; 22 import gov.nasa.jpf.jvm.JVM; 23 import gov.nasa.jpf.jvm.Reference; 24 import gov.nasa.jpf.jvm.SystemState; 25 26 27 34 public class UserHeuristic implements Heuristic { 35 static final int defaultValue = 1000; 36 VM vm; 37 38 public UserHeuristic (HeuristicSearch hSearch) { 39 vm = hSearch.getVM(); 40 } 41 42 public int heuristicValue () { 43 SystemState ss = (SystemState) ((JVM) vm).getSystemState(); 45 Reference p = ss.getClass("Main"); 46 47 if (p != null) { 48 Reference b = p.getObjectField("buffer", null); 49 50 if (b != null) { 51 int current = b.getIntField("current", null); 52 int capacity = b.getIntField("capacity", null); 53 54 return (capacity - current); 55 } 56 } 57 58 return defaultValue; 59 } 60 61 public void processParent () { 62 } 63 } 64 | Popular Tags |