ignore jnetconf
[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 PFAM    = 5;\r
31 \r
32   static FormatPropertyVector formats = new FormatPropertyVector();\r
33 \r
34   static {\r
35     String prefix = getDefaultClassPrefix();\r
36 \r
37     formats.add("FASTA",  prefix + "FastaFile");\r
38     formats.add("MSF",    prefix + "MSFfile");\r
39     formats.add("CLUSTAL",prefix + "ClustalFile");\r
40     formats.add("BLC",    prefix + "BLCFile");\r
41     formats.add("PIR",    prefix + "PIRFile");\r
42     formats.add("PFAM",   prefix + "PfamFile");\r
43   }\r
44 \r
45   public static String getDefaultClassPrefix() {\r
46     return "jalview.io.";\r
47   }\r
48 \r
49   static int indexOf(String format) {\r
50 \r
51     if (format != null) {\r
52        format.toUpperCase();\r
53        if (formats.contains(format)) {\r
54          return formats.indexOf(format);\r
55        }\r
56     }\r
57     return -1;\r
58   }\r
59 \r
60   public static String getClassName(int index) {\r
61     return formats.getClassName(index);\r
62   }\r
63 \r
64   public static boolean contains(String format) {\r
65 \r
66     if (format != null) {\r
67       format.toUpperCase();\r
68 \r
69       if (formats.contains(format)) {\r
70         return true;\r
71       }\r
72     }\r
73     return false;\r
74   }\r
75 \r
76   public static Vector getFormatNames() {\r
77     return formats.getFormatNames();\r
78   }\r
79 \r
80   public static Vector getFormats() {\r
81     return formats.getFormatNames();\r
82   }\r
83 }\r