-/**
- *
- */
-package uk.ac.vamsas.objects.utils.document;
-
-import java.util.Hashtable;
-
-/**
- * enumerates versions for the VamsasDocument.Version string
- * provides version comparison methods
- * TODO: LATER: associate schema versions with these strings
- */
-public class VersionEntries {
- public static final String ALPHA_VERSION="alpha";
- public static final String BETA_VERSION="beta";
- protected static Hashtable versions;
- static {
- versions = new Hashtable();
- // integers represent version hierarchy - 0 precedes 1
- versions.put(ALPHA_VERSION, new Integer(0));
- versions.put(BETA_VERSION, new Integer(1));
- }
- // TODO: LATER: decide on best pattern for enumeration classes (ie - need an ordered list of versions, and validator, plus explicit enum-strings)
- public static boolean isVersion(String vstring) {
- return versions.containsKey(vstring);
- }
- /**
- * returns 0 if levels are equivalent,
- * 1 if higher is valid and higher,
- * 2 if lower is valid and higher
- * -1 if both levels are invalid
- * @param higher
- * @param lower
- * @return
- */
- public static int compare(String higher, String lower) {
- int v_1 = versions.containsKey(higher) ? ((Integer) versions.get(higher)).intValue() : -1;
- int v_2 = versions.containsKey(lower) ? ((Integer) versions.get(lower)).intValue() : -1;
- int comp = v_1<v_2 ? 2 : v_1 == v_2 ? 0 : 1;
- return (comp==0) ? (v_1!=-1 ? 0 : -1) : comp;
- }
- /**
- * @return the latest version that this vamsas library supports
- */
- public static String latestVersion() {
- return BETA_VERSION;
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client 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 Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils.document;\r
+\r
+import java.util.Hashtable;\r
+\r
+/**\r
+ * enumerates versions for the VamsasDocument.Version string provides version\r
+ * comparison methods TODO: LATER: associate schema versions with these strings\r
+ */\r
+public class VersionEntries {\r
+ public static final String ALPHA_VERSION = "alpha";\r
+\r
+ public static final String BETA_VERSION = "beta";\r
+\r
+ protected static Hashtable versions;\r
+ static {\r
+ versions = new Hashtable();\r
+ // integers represent version hierarchy - 0 precedes 1\r
+ versions.put(ALPHA_VERSION, new Integer(0));\r
+ versions.put(BETA_VERSION, new Integer(1));\r
+ }\r
+\r
+ // TODO: LATER: decide on best pattern for enumeration classes (ie - need an\r
+ // ordered list of versions, and validator, plus explicit enum-strings)\r
+ public static boolean isVersion(String vstring) {\r
+ return versions.containsKey(vstring);\r
+ }\r
+\r
+ /**\r
+ * returns 0 if levels are equivalent, 1 if higher is valid and higher, 2 if\r
+ * lower is valid and higher -1 if both levels are invalid\r
+ * \r
+ * @param higher\r
+ * @param lower\r
+ * @return\r
+ */\r
+ public static int compare(String higher, String lower) {\r
+ int v_1 = versions.containsKey(higher) ? ((Integer) versions.get(higher))\r
+ .intValue() : -1;\r
+ int v_2 = versions.containsKey(lower) ? ((Integer) versions.get(lower))\r
+ .intValue() : -1;\r
+ int comp = v_1 < v_2 ? 2 : v_1 == v_2 ? 0 : 1;\r
+ return (comp == 0) ? (v_1 != -1 ? 0 : -1) : comp;\r
+ }\r
+\r
+ /**\r
+ * @return the latest version that this vamsas library supports\r
+ */\r
+ public static String latestVersion() {\r
+ return BETA_VERSION;\r
+ }\r
+\r
+}\r