+++ /dev/null
-package jalview.io;\r
-\r
-import jalview.datamodel.*;\r
-\r
-import java.lang.reflect.*;\r
-\r
-public class FormatFactory {\r
-\r
- public static AlignFile get(int index) {\r
- try {\r
- Class c = Class.forName(FormatProperties.getClassName(index));\r
- Class [] paramTypes = new Class[1];\r
- paramTypes[0] = SequenceI[].class;\r
-\r
- Constructor cons = c.getConstructor(null);\r
-\r
- return (AlignFile)cons.newInstance(null);\r
- } catch (Exception e) {\r
- System.err.println("Errore FFactory:"+e);\r
- return null;\r
- }\r
- }\r
-\r
- public static AlignFile get(int index,String inStr) {\r
- try {\r
- Class c = Class.forName(FormatProperties.getClassName(index));\r
- Class [] paramTypes = new Class[1];\r
- paramTypes[0] = String.class;\r
- Constructor cons = c.getConstructor(paramTypes);\r
-\r
- Object [] params = new Object[1];\r
- params[0] = inStr;\r
- return (AlignFile)cons.newInstance(params);\r
- } catch (Exception e) {\r
- System.err.println("error2"+e);\r
- return null;\r
- }\r
- }\r
-\r
- public static AlignFile get(int index,String inFile,String type) {\r
- try {\r
-\r
- Class c = Class.forName(FormatProperties.getClassName(index));\r
- Class [] paramTypes = new Class[2];\r
- paramTypes[0] = String.class;\r
- paramTypes[1] = String.class;\r
- Constructor cons = c.getConstructor(paramTypes);\r
- Object [] params = new Object[2];\r
- params[0] = inFile;\r
- params[1] = type;\r
-\r
- AlignFile af = (AlignFile)cons.newInstance(params);\r
-\r
- return af;\r
- } catch (Exception e) {\r
- System.err.println("FormatFactory "+e);\r
- return null;\r
- }\r
- }\r
-\r
- public static AlignFile get(String format) {\r
- return get(FormatProperties.indexOf(format));\r
- }\r
-\r
- public static AlignFile get(String format,String inStr) {\r
- return get(FormatProperties.indexOf(format),inStr);\r
- }\r
- public static AlignFile get(String format,String inFile,String type) {\r
- return get(FormatProperties.indexOf(format),inFile,type);\r
- }\r
-}\r
+++ /dev/null
-/* Jalview - a java multiple alignment editor\r
- * Copyright (C) 1998 Michele Clamp\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
- */\r
-\r
-package jalview.io;\r
-\r
-import java.util.*;\r
-\r
-public class FormatProperties {\r
-\r
- static final int FASTA = 0;\r
- static final int MSF = 1;\r
- static final int CLUSTAL = 2;\r
- static final int BLC = 3;\r
- static final int PIR = 4;\r
- static final int PFAM = 5;\r
-\r
- static FormatPropertyVector formats = new FormatPropertyVector();\r
-\r
- static {\r
- String prefix = getDefaultClassPrefix();\r
-\r
- formats.add("FASTA", prefix + "FastaFile");\r
- formats.add("MSF", prefix + "MSFfile");\r
- formats.add("CLUSTAL",prefix + "ClustalFile");\r
- formats.add("BLC", prefix + "BLCFile");\r
- formats.add("PIR", prefix + "PIRFile");\r
- formats.add("PFAM", prefix + "PfamFile");\r
- }\r
-\r
- public static String getDefaultClassPrefix() {\r
- return "jalview.io.";\r
- }\r
-\r
- static int indexOf(String format) {\r
-\r
- if (format != null) {\r
- format.toUpperCase();\r
- if (formats.contains(format)) {\r
- return formats.indexOf(format);\r
- }\r
- }\r
- return -1;\r
- }\r
-\r
- public static String getClassName(int index) {\r
- return formats.getClassName(index);\r
- }\r
-\r
- public static boolean contains(String format) {\r
-\r
- if (format != null) {\r
- format.toUpperCase();\r
-\r
- if (formats.contains(format)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- public static Vector getFormatNames() {\r
- return formats.getFormatNames();\r
- }\r
-\r
- public static Vector getFormats() {\r
- return formats.getFormatNames();\r
- }\r
-}\r
+++ /dev/null
-package jalview.io;\r
-\r
-public class FormatProperty {\r
- String description;\r
- String className;\r
-\r
- public FormatProperty(String description, String className) {\r
- this.description = new String(description);\r
- this.className = new String(className);\r
- }\r
-\r
- public String getClassName() {\r
- return className;\r
- }\r
- public String getDescription() {\r
- return description;\r
- }\r
-}\r
+++ /dev/null
-package jalview.io;\r
-\r
-import java.util.*;\r
-\r
-public class FormatPropertyVector {\r
- Vector formatProps = new Vector();\r
- Vector formatDescs = new Vector();\r
-\r
- public void add(String description,String className) {\r
- formatProps.addElement(new FormatProperty(description,className));\r
- formatDescs.addElement(description);\r
- }\r
- public Vector getFormatNames() {\r
- return formatDescs;\r
- }\r
-\r
- public String getClassName(int ind) {\r
- return ((FormatProperty)formatProps.elementAt(ind)).getClassName();\r
- }\r
-\r
- public String getSchemeName(int ind) {\r
- return ((FormatProperty)formatProps.elementAt(ind)).getDescription();\r
- }\r
-\r
- public boolean contains(String description) {\r
- return formatDescs.contains(description);\r
- }\r
-\r
- public int indexOf(String description) {\r
- return formatDescs.indexOf(description);\r
- }\r
-}\r