Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TrailInfo.java

00001 package gov.nasa.arc.ase.jpf.jvm;
00002 
00003 import de.fub.bytecode.generic.*;
00004 import gov.nasa.arc.ase.jpf.*;
00005 import gov.nasa.arc.ase.util.Debug;
00006 import java.io.*;
00007 import java.util.*;
00008 
00009 class TrailInfo implements iTrailInfo {
00010   private int thread;
00011   private int random;
00012   private int line;
00013   private String classname;
00014   private List pcs = new ArrayList();
00015 
00016 // ifdef BUCHI
00017 
00018 
00019 
00020 
00021 
00022 //#endif BUCHI
00023   public TrailInfo(int thread, 
00024                    int random, 
00025                    int line,
00026                    String cname) {
00027     this.thread = thread;
00028     this.random = random;
00029     this.line = line;
00030     this.classname = cname;
00031   }  
00032   public void addPC(InstructionHandle pc) {
00033     pcs.add(pc);
00034   }  
00035   public void dump2file(BufferedWriter out) {
00036     Source source = Source.getSource(classname);
00037     if (source != null)
00038       try {
00039     source.dump2file(out,thread,line);
00040       } catch (IOException e) {}
00041   }  
00042   public String getClassname() {
00043     return this.classname;
00044   }  
00045   public int getLine() {
00046     return this.line;
00047   }  
00048   public int getRandom() {
00049     return this.random;
00050   }  
00051   public int getThread() {
00052     return this.thread;
00053   }  
00054   private void indent() {
00055     for (int i = 0;i < thread;i++) {
00056       Debug.print(Debug.WARNING, "           |");
00057     };
00058   }  
00059   public void print() {
00060     Source source = Source.getSource(classname);
00061     indent();
00062     if (source != null)
00063       source.print(thread, line); 
00064 // ifdef BUCHI
00065 
00066 
00067 //#endif BUCHI
00068     if (VirtualMachine.options.bytecode_dump) {
00069       for (int i = 0; i < pcs.size();i++) {
00070         indent();
00071         Debug.print(Debug.WARNING, "         ");
00072         Debug.println(Debug.WARNING, pcs.get(i).toString()); 
00073       }
00074       Debug.println(Debug.WARNING, "-------------------------------------------------------------------------------");
00075     }
00076   }  
00077   public String toString() {
00078     Source source = Source.getSource(classname);
00079     if (source == null)
00080       return "";
00081     StringBuffer sb = new StringBuffer();
00082 // ifdef BUCHI
00083 
00084 
00085 //#endif BUCHI
00086     for (int j = 0; j < thread; j++)
00087       sb.append(" |  ");
00088     sb.append(source.getLine(thread, line));
00089     if (VirtualMachine.options.bytecode_dump) {
00090       for (int i = 0; i < pcs.size();i++) {
00091     sb.append("\n");
00092     sb.append(pcs.get(i).toString());
00093       }
00094       sb.append("\n-------------------------------------------------------------------------------");
00095     }
00096 
00097     return sb.toString();
00098   }  
00099 }

Generated at Thu Feb 7 06:57:52 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001