00001 package gov.nasa.arc.ase.jpf.jvm; 00002 00003 import gov.nasa.arc.ase.jpf.iSystemState; 00004 import gov.nasa.arc.ase.jpf.iThreadInfo; 00005 import gov.nasa.arc.ase.jpf.JPFErrorException; 00006 00007 public class PathScheduler extends Scheduler { 00008 private JVMPath path; 00009 private int position; 00010 00011 public PathScheduler(iSystemState ss, JVMPath p) { 00012 initialize(ss); 00013 position = 0; 00014 path = p; 00015 } 00016 public PathScheduler(PathScheduler ps) { 00017 path = ps.path; 00018 position = ps.position; 00019 ss = null; 00020 } 00021 public Object clone() { 00022 return new PathScheduler(this); 00023 } 00024 public int getRandom() { 00025 if(position < path.size()) 00026 return path.get(position).random; 00027 else 00028 return 0; 00029 } 00030 public int getThread() { 00031 if(position < path.size()) 00032 return path.get(position).thread; 00033 else 00034 return 0; 00035 } 00036 public void initialize(iSystemState ss) { 00037 this.ss = (SystemState)ss; 00038 position++; 00039 } 00040 public iThreadInfo locateThread(iSystemState ss) { 00041 if(position < path.size()) 00042 return ss.getThreadInfo(getThread()); 00043 else 00044 return null; 00045 } 00046 public void next() { 00047 } 00048 public int random(int max) { 00049 return getRandom(); 00050 } 00051 }