Jalview Imported Sources
[jalview.git] / src / jalview / io / FormatProperties.java
1 /* Jalview - a java multiple alignment editor\r
2  * Copyright (C) 1998  Michele Clamp\r
3  *\r
4  * This program is free software; you can redistribute it and/or\r
5  * modify it under the terms of the GNU General Public License\r
6  * as published by the Free Software Foundation; either version 2\r
7  * of the License, or (at your option) any later version.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License\r
15  * along with this program; if not, write to the Free Software\r
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
17  */\r
18 \r
19 package jalview.io;\r
20 \r
21 import java.util.*;\r
22 \r
23 public class FormatProperties {\r
24 \r
25   static final int FASTA   = 0;\r
26   static final int MSF     = 1;\r
27   static final int CLUSTAL = 2;\r
28   static final int BLC     = 3;\r
29   static final int PIR     = 4;\r
30  //static final int MSP     = 5;\r
31   static final int PFAM    = 5;\r
32  // static final int POSTAL  = 7;\r
33 //  static final int JNET    = 8;\r
34 \r
35   static FormatPropertyVector formats = new FormatPropertyVector();\r
36 \r
37   static {\r
38     String prefix = getDefaultClassPrefix();\r
39 \r
40     formats.add("FASTA",  prefix + "FastaFile");\r
41     formats.add("MSF",    prefix + "MSFfile");\r
42     formats.add("CLUSTAL",prefix + "ClustalFile");\r
43     formats.add("BLC",    prefix + "BLCFile");\r
44     formats.add("PIR",    prefix + "PIRFile");\r
45   //  formats.add("MSP",    prefix + "MSPFile");\r
46     formats.add("PFAM",   prefix + "PfamFile");\r
47    //formats.add("POSTAL", prefix + "PostalFile");\r
48    // formats.add("JNET",   prefix + "JnetFile");\r
49   }\r
50 \r
51   public static String getDefaultClassPrefix() {\r
52     return "jalview.io.";\r
53   }\r
54 \r
55   static int indexOf(String format) {\r
56 \r
57     if (format != null) {\r
58        format.toUpperCase();\r
59        if (formats.contains(format)) {\r
60          return formats.indexOf(format);\r
61        }\r
62     }\r
63     return -1;\r
64   }\r
65 \r
66   public static String getClassName(int index) {\r
67     return formats.getClassName(index);\r
68   }\r
69 \r
70   public static boolean contains(String format) {\r
71 \r
72     if (format != null) {\r
73       format.toUpperCase();\r
74 \r
75       if (formats.contains(format)) {\r
76         return true;\r
77       }\r
78     }\r
79     return false;\r
80   }\r
81 \r
82   public static Vector getFormatNames() {\r
83     return formats.getFormatNames();\r
84   }\r
85 \r
86   public static Vector getFormats() {\r
87     return formats.getFormatNames();\r
88   }\r
89 }\r