/* * Created on Oct 17, 2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package fr.lifl.stc.stan.classAnnoter; import java.io.IOException; import org.apache.bcel.classfile.ClassParser; import org.apache.bcel.classfile.JavaClass; import fr.lifl.stc.stan.signature.SignatureDictionary; /** * @author dorina * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class LinkAnnoter { JavaClass[]classes; SignatureDictionary dict; String dictName = "dicotests.txt"; LinkAnnoter(JavaClass[] classes) { this.classes = classes; try{ dict = new SignatureDictionary(dictName); } catch (ClassNotFoundException e) { System.err.println("Error: Dictionary contains unknown classes"); System.exit(1); } } void annotate() throws IOException{ for(int i = 0; i< classes.length; i++) { LinkMapClassAnnoter la = new LinkMapClassAnnoter(classes[i], dict); la.annotateClass(); //annotateClass(classes[i]); } } public static void main(String[] args) { JavaClass classes[]; // Printer.println("PROGRAM ARGUMENTS: "+args.length); int i=0; LinkAnnoter cpanalyser; try { classes = new JavaClass[args.length]; for (i = 0; i < args.length; i++) classes[i] = (new ClassParser(args[i])).parse(); cpanalyser = new LinkAnnoter(classes); cpanalyser.annotate(); } catch (IOException e) { e.printStackTrace(); System.err.println("E: File " + args[i] + " does not exist or you don't have permission on it."); } /* catch (ClassNotFoundException e) { System.err.println("E: Internal error"); e.printStackTrace(); }*/ catch (OutOfMemoryError er) { System.err.println("EXCEPTION:: "+er); er.printStackTrace(); } } }