3 import jalview.datamodel.*;
\r
5 import java.lang.reflect.*;
\r
7 public class FormatFactory {
\r
9 public static AlignFile get(int index) {
\r
11 Class c = Class.forName(FormatProperties.getClassName(index));
\r
12 Class [] paramTypes = new Class[1];
\r
13 paramTypes[0] = SequenceI[].class;
\r
15 Constructor cons = c.getConstructor(null);
\r
17 return (AlignFile)cons.newInstance(null);
\r
18 } catch (Exception e) {
\r
19 System.err.println("Errore FFactory:"+e);
\r
24 public static AlignFile get(int index,String inStr) {
\r
26 Class c = Class.forName(FormatProperties.getClassName(index));
\r
27 Class [] paramTypes = new Class[1];
\r
28 paramTypes[0] = String.class;
\r
29 Constructor cons = c.getConstructor(paramTypes);
\r
31 Object [] params = new Object[1];
\r
33 return (AlignFile)cons.newInstance(params);
\r
34 } catch (Exception e) {
\r
35 System.err.println("error2"+e);
\r
40 public static AlignFile get(int index,String inFile,String type) {
\r
43 Class c = Class.forName(FormatProperties.getClassName(index));
\r
44 Class [] paramTypes = new Class[2];
\r
45 paramTypes[0] = String.class;
\r
46 paramTypes[1] = String.class;
\r
47 Constructor cons = c.getConstructor(paramTypes);
\r
48 Object [] params = new Object[2];
\r
52 AlignFile af = (AlignFile)cons.newInstance(params);
\r
55 } catch (Exception e) {
\r
56 System.err.println("FormatFactory "+e);
\r
61 public static AlignFile get(String format) {
\r
62 return get(FormatProperties.indexOf(format));
\r
65 public static AlignFile get(String format,String inStr) {
\r
66 return get(FormatProperties.indexOf(format),inStr);
\r
68 public static AlignFile get(String format,String inFile,String type) {
\r
69 return get(FormatProperties.indexOf(format),inFile,type);
\r