From: jprocter Date: Fri, 22 Feb 2008 16:31:40 +0000 (+0000) Subject: valid format for writing test X-Git-Tag: Release_2_4~125 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f49e86c9f8e7c0301f2b8824d0c033a3df291e6a;p=jalview.git valid format for writing test --- diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 05de682..c7b0575 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -113,10 +113,21 @@ public class AppletFormatAdapter */ public static final boolean isValidFormat(String format) { + return isValidFormat(format, false); + } + /** + * validate format is valid for IO + * @param format a format string to be compared with either READABLE_FORMATS or WRITEABLE_FORMATS + * @param forwriting when true, format is checked for containment in WRITEABLE_FORMATS + * @return true if format is valid + */ + public static final boolean isValidFormat(String format, boolean forwriting) + { boolean valid = false; - for (int i = 0; i < READABLE_FORMATS.length; i++) + String[] format_list = (forwriting) ? WRITEABLE_FORMATS : READABLE_FORMATS; + for (int i = 0; i < format_list.length; i++) { - if (READABLE_FORMATS[i].equalsIgnoreCase(format)) + if (format_list[i].equalsIgnoreCase(format)) { return true; } @@ -124,7 +135,7 @@ public class AppletFormatAdapter return valid; } - + /** * Constructs the correct filetype parser for a characterised datasource *