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

JavaIoPrintStreamReflection.java

00001 package gov.nasa.arc.ase.jpf.jvm.reflection;
00002 
00003 import gov.nasa.arc.ase.jpf.jvm.VirtualMachine;
00004 import gov.nasa.arc.ase.jpf.jvm.MethodInfo;
00005 import gov.nasa.arc.ase.jpf.jvm.bytecode.Instruction;
00006 
00007 public class JavaIoPrintStreamReflection extends Reflection {
00008   public Instruction executeMethod(MethodInfo mi) {
00009     String name = mi.getFullName();
00010 
00011     if(name.equals("println()V")) {
00012       println();
00013       return exit();
00014     }
00015 
00016     if(name.equals("print(Ljava/lang/String;)V")) {
00017       print(getStringArgument(1));
00018       return exit();
00019     }
00020 
00021     if(name.equals("println(Ljava/lang/String;)V")) {
00022       println(getStringArgument(1));
00023       return exit();
00024     }
00025 
00026     if(name.equals("print(I)V")) {
00027       print(getIntArgument(1));
00028       return exit();
00029     }
00030 
00031     if(name.equals("println(I)V")) {
00032       println(getIntArgument(1));
00033       return exit();
00034     }
00035 
00036     if(name.equals("print(F)V")) {
00037       print(getFloatArgument(1));
00038       return exit();
00039     }
00040 
00041     if(name.equals("println(F)V")) {
00042       println(getFloatArgument(1));
00043       return exit();
00044     }
00045 
00046     if(name.equals("print(J)V")) {
00047       print(getLongArgument(1));
00048       return exit();
00049     }
00050 
00051     if(name.equals("println(J)V")) {
00052       println(getLongArgument(1));
00053       return exit();
00054     }
00055 
00056     if(name.equals("print(D)V")) {
00057       print(getDoubleArgument(1));
00058       return exit();
00059     }
00060 
00061     if(name.equals("println(D)V")) {
00062       println(getDoubleArgument(1));
00063       return exit();
00064     }
00065 
00066     if(name.equals("print(Z)V")) {
00067       print(getBooleanArgument(1));
00068       return exit();
00069     }
00070 
00071     if(name.equals("println(Z)V")) {
00072       println(getBooleanArgument(1));
00073       return exit();
00074     }
00075 
00076     return super.executeMethod(mi);
00077   }  
00078   public boolean isMethodExecutable(MethodInfo mi) {
00079     String name = mi.getFullName();
00080 
00081     if(name.equals("println()V"))
00082       return true;
00083 
00084     if(name.equals("print(Ljava/lang/String;)V"))
00085       return true;
00086 
00087     if(name.equals("println(Ljava/lang/String;)V"))
00088       return true;
00089 
00090     if(name.equals("print(I)V"))
00091       return true;
00092 
00093     if(name.equals("println(I)V"))
00094       return true;
00095 
00096     if(name.equals("print(F)V"))
00097       return true;
00098 
00099     if(name.equals("println(F)V"))
00100       return true;
00101 
00102     if(name.equals("print(Z)V"))
00103       return true;
00104 
00105     if(name.equals("println(Z)V"))
00106       return true;
00107 
00108     return super.isMethodExecutable(mi);
00109   }  
00110   public void print(double d) {
00111     if(VirtualMachine.options.verify_print) System.out.print(d);
00112   }  
00113   public void print(float f) {
00114     if(VirtualMachine.options.verify_print) System.out.print(f);
00115   }  
00116   public void print(int i) {
00117     if(VirtualMachine.options.verify_print) System.out.print(i);
00118   }  
00119   public void print(long l) {
00120     if(VirtualMachine.options.verify_print) System.out.print(l);
00121   }  
00122   public void print(String s) {
00123     if(VirtualMachine.options.verify_print) System.out.print(s);
00124   }  
00125   public void print(boolean b) {
00126     if(VirtualMachine.options.verify_print) System.out.print(b);
00127   }  
00128   public void println() {
00129     if(VirtualMachine.options.verify_print) System.out.println();
00130   }  
00131   public void println(double d) {
00132     if(VirtualMachine.options.verify_print) System.out.println(d);
00133   }  
00134   public void println(float f) {
00135     if(VirtualMachine.options.verify_print) System.out.println(f);
00136   }  
00137   public void println(int i) {
00138     if(VirtualMachine.options.verify_print) System.out.println(i);
00139   }  
00140   public void println(long l) {
00141     if(VirtualMachine.options.verify_print) System.out.println(l);
00142   }  
00143   public void println(String s) {
00144     if(VirtualMachine.options.verify_print) System.out.println(s);
00145   }  
00146   public void println(boolean b) {
00147     if(VirtualMachine.options.verify_print) System.out.println(b);
00148   }  
00149 }

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