예제 #1
0
 /** ***************** Resets the graphics, lists, processes, stats, etc. */
 public void reset() {
   if (gFile != null) {
     try {
       loadFile(gFile);
     } catch (FileNotFoundException e) {
       e.printStackTrace();
     }
   } else {
     gProcList.clear();
     gPreviousProc = null;
     gParentWindow.halt();
     gCurrentScheduler.clear();
     gTicks = 0;
     gGraphicsComp.init();
     gStatsComp.init();
     Process.SYSTEM_PROCESS.reset();
   }
 }
예제 #2
0
 /**
  * ****************** Loads a file as a process list
  *
  * @param mFile the file to load
  * @throws FileNotFoundException
  */
 public void loadFile(File mFile) throws FileNotFoundException {
   gProcList.clear();
   gPreviousProc = null;
   gParentWindow.halt();
   gCurrentScheduler.clear();
   gTicks = 0;
   gGraphicsComp.init();
   gStatsComp.init();
   Process.SYSTEM_PROCESS.reset();
   gFile = mFile;
   Scanner tScanner = new Scanner(gFile);
   while (tScanner.hasNextLine()) {
     String tmp = tScanner.nextLine();
     if (tmp.length() > 0 && tmp.charAt(0) != '#') {
       try {
         gProcList.add(new Process(tmp));
       } catch (RuntimeException e) {
         System.err.println(e.getMessage());
       }
     }
     gGraphicsComp.setProcList(gProcList);
   }
 }