Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: engine/GenericInstruction.java


1   
2   /* **********************************
3    File:GenericInstruction.java
4    Author: Alec(panovici@elcom.pub.ro)
5    Created on 12.02.1999 02:42:26
6    Comments: Part of the vIDE Project
7               Copyright 1999 the vIDE Team.
8   ***********************************/
9   
10  package engine;
11  
12  /**
13   * This is a placeholder for a runtime generated action
14   * (such as delayed value updates in monitors). An
15   * Executable can be plugged into a GenericInstruction
16   * so it can be scheduled at a later time.
17   */
18  class GenericInstruction extends Instruction{
19    
20    Executable target;
21    int state;
22    
23    public GenericInstruction (Executable target) {
24      this.target = target;
25    }
26    
27    public String toString(){
28      return target.toString();
29    }
30    
31    public void execute ()
32      throws InterpretTimeException, SimulationStoppedException
33    {
34      target.execute();
35      state = 1;
36      /*    if (next != null) next.execute();
37            next = null;*/
38    }
39  
40    public Instruction next() {
41      if (state == 1) {
42        state = 0;
43        Instruction tmp = next;
44        next = null;
45        return tmp;
46      }
47      return next;
48    }
49  }
50