*/
package jalview.io;
-import jalview.bin.Instance;
-
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
*/
public class FileFormats
{
+ private static FileFormats instance = new FileFormats();
+
+ /*
+ * A lookup map of file formats by upper-cased name
+ */
+ private static Map<String, FileFormatI> formats;
+
+ /*
+ * Formats in this set are capable of being identified by IdentifyFile
+ */
+ private static Set<FileFormatI> identifiable;
+
public static FileFormats getInstance()
{
- Instance i = Instance.getInstance();
- return (i.fileFormats == null ? i.fileFormats = new FileFormats()
- : i.fileFormats);
+ return instance;
}
/**
reset();
}
- /*
- * A lookup map of file formats by upper-cased name
- */
- private Map<String, FileFormatI> formats;
-
- /*
- * Formats in this set are capable of being identified by IdentifyFile
- */
- private Set<FileFormatI> identifiable;
-
/**
* Reset to just the built-in file formats packaged with Jalview. These are
* added (and will be shown in menus) in the order of their declaration in the
*/
public synchronized void reset()
{
- formats = new LinkedHashMap<>();
- identifiable = new HashSet<>();
+ formats = new LinkedHashMap<String, FileFormatI>();
+ identifiable = new HashSet<FileFormatI>();
for (FileFormat format : FileFormat.values())
{
registerFileFormat(format, format.isIdentifiable());
*/
public List<String> getWritableFormats(boolean textOnly)
{
- List<String> l = new ArrayList<>();
+ List<String> l = new ArrayList<String>();
for (FileFormatI ff : formats.values())
{
if (ff.isWritable() && (!textOnly || ff.isTextFormat()))
*/
public List<String> getReadableFormats()
{
- List<String> l = new ArrayList<>();
+ List<String> l = new ArrayList<String>();
for (FileFormatI ff : formats.values())
{
if (ff.isReadable())