/*     */ package org.logic;
/*     */ 
/*     */ import java.lang.reflect.InvocationTargetException;
/*     */ import javax.swing.JOptionPane;
/*     */ import org.ui.editors.code.CodeEditor;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class GyteProcessor
/*     */   extends Thread
/*     */ {
/*     */   private GyteController gyteController;
/*     */   private CodeEditor editor;
/*     */   private Program program;
/*     */   
/*     */   public GyteProcessor(GyteController gyteController, CodeEditor editor) {
/*  32 */     this.gyteController = gyteController;
/*  33 */     this.editor = editor;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void run() {
/*  45 */     this.editor.setProgramStatus(true);
/*     */     
/*     */     try {
/*  48 */       this.program.getMainMethod().invoke(this.program.getProgram(), new Object[] { this.gyteController });
/*     */     }
/*  50 */     catch (IllegalAccessException e) {
/*  51 */       e.printStackTrace();
/*  52 */     } catch (IllegalArgumentException e) {
/*  53 */       e.printStackTrace();
/*  54 */     } catch (InvocationTargetException e) {
/*  55 */       if (!(e.getCause() instanceof org.run.ForcedStopException))
/*     */       {
/*     */ 
/*     */         
/*  59 */         System.err.println("The Gyte-Processors Thread did not respond in time and killed");
/*     */       }
/*     */     } 
/*  62 */     System.out.println("> Gyte-Processor has finished");
/*  63 */     this.editor.setProgramStatus(false);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void dispatchProgram(Program program) {
/*  72 */     this.program = program;
/*     */     
/*  74 */     synchronized (this) {
/*     */       
/*  76 */       start();
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void halt() {
/*  89 */     interrupt();
/*     */ 
/*     */ 
/*     */     
/*  93 */     try { join(2000L);
/*     */ 
/*     */       
/*  96 */       if (isAlive()) {
/*  97 */         stop();
/*     */       } }
/*  99 */     catch (InterruptedException interruptedException) {  }
/* 100 */     catch (SecurityException death)
/*     */     
/* 102 */     { JOptionPane.showMessageDialog(null, "The Thread running GYTEBOTS code needed to be stopped by ThreadDeath", "Error - stopping Thread", 0); }
/*     */   
/*     */   }
/*     */ }


/* Location:              /home/teridax/Projects/Gytebot/GYTEBOT.jar!/org/logic/GyteProcessor.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */