Source code for /engineering/autohit-1998/autohit/Scenario.javaOriginal file Scenario.java
   1 /**
   2  * .
   3  * Copyright � 1999 Erich P G.
   4  *
   5  */
   6  
   7 package autohit;
   8 
   9 import java.io.Serializable;
  10 import java.util.Vector;
  11 
  12 import autohit.vm.VMInstruction;
  13 
  14 /**
  15  * Scenario is the basic class for a scenario.  Each represents a test as executed on
  16  * a single test station.
  17  * <p>
  18  *
  19  * @author Erich P. Gatejen
  20  * @version 1.0
  21  * <i>Version History</i>
  22  * <code>EPG - Initial - 12Feb99</code> 
  23  * 
  24  */
  25 public class Scenario implements Serializable {
  26 	
  27 	// --- FINAL FIELDS ------------------------------------------------------	
  28 
  29 	// --- FIELDS ------------------------------------------------------------
  30 
  31     /**
  32      *  A vector containing the Scenario executable.
  33      *  Each member-object will be a vmInstruction derived class object.
  34      *
  35      *  @see autohit.vm.VMInstruction
  36      *  @serial
  37      */      	
  38     public Vector      exec;
  39     
  40     /**
  41      * This scenario's name.
  42      *
  43      *  @serial
  44      */      	
  45     public String      name;
  46     
  47     /**
  48      * Associated note.
  49      *  
  50      *  @serial
  51      */      	
  52     public String      note;       
  53 
  54 	// --- PUBLIC METHODS ----------------------------------------------------	
  55 
  56     /**
  57      *  Default Constructor.  It will create an empty Sim.  Remember!  If you are
  58      *  creating a new Sim, but sure to call init().
  59      *
  60      *  @see #init()
  61      */
  62     public Scenario() {
  63         
  64     }    
  65 
  66     /**
  67      *  Initializes a brand-new Scenario().
  68      */
  69     public void init() {
  70 
  71         exec = new Vector();
  72     }
  73     
  74     /**
  75      *  Dump this SCENARIO.  I'm putting this in for debugging.  It might have some other
  76      *  uses...
  77      *
  78      *  @return a String containing the dump.
  79      */
  80     public String toString() {
  81     
  82         StringBuffer d = new StringBuffer();
  83         
  84         d.append("Scenario Dump ===============================\n");
  85         d.append("Name = [" + name + "]\n");
  86         d.append("Note ----------------------------------- \n");
  87         d.append(note);
  88         d.append("\n---------------------------------------- \n");
  89         d.append("Executable ----------------------------- \n");
  90         VMInstruction  vmi;
  91         for (int idx = 0; idx < exec.size(); idx++) {
  92             d.append("IP = " + idx);
  93             vmi = (VMInstruction)exec.get(idx);
  94             d.append(vmi.toString());
  95         }
  96         d.append("---------------------------------------- \n");        
  97         return d.toString();        
  98     }       
  99     
 100 	// --- PRIVATE METHODS ---------------------------------------------------	
 101 
 102 
 103 }