// and finally return.
return af;
}
- Vector<AppJmol> newStructureViewers=null;
+
+ /**
+ *
+ * @param supported - minimum version we are comparing against
+ * @param version - version of data being processsed.
+ * @return true if version is development/null or evaluates to the same or
+ * later X.Y.Z (where X,Y,Z are like [0-9]+b?[0-9]*)
+ */
+ private boolean isVersionStringLaterThan(String supported, String version)
+ {
+ if (version == null || version.equalsIgnoreCase("DEVELOPMENT BUILD")
+ || version.equalsIgnoreCase("Test"))
+ {
+ System.err.println("Assuming project file with "
+ + (version == null ? "null" : version)
+ + " is compatible with Jalview version " + supported);
+ return true;
+ }
+ else
+ {
+ StringTokenizer currentV = new StringTokenizer(supported, "."), fileV = new StringTokenizer(
+ version, ".");
+ while (currentV.hasMoreTokens() && fileV.hasMoreTokens())
+ {
+ // convert b to decimal to catch bugfix releases within a series
+ String curT = currentV.nextToken().toLowerCase().replace('b', '.');
+ String fileT = fileV.nextToken().toLowerCase().replace('b', '.');
+ try
+ {
+ if (Float.valueOf(curT) > Float.valueOf(fileT))
+ {
+ // current version is newer than the version that wrote the file
+ return false;
+ }
+ } catch (NumberFormatException nfe)
+ {
+ System.err
+ .println("** WARNING: Version comparison failed for tokens ("
+ + curT
+ + ") and ("
+ + fileT
+ + ")\n** Current: '"
+ + supported + "' and Version: '" + version + "'");
+ }
+ }
+ if (currentV.hasMoreElements())
+ {
+ // fileV has no minor version but identical series to current
+ return false;
+ }
+ }
+ return true;
+ }
+
+ Vector<AppJmol> newStructureViewers = null;
+
protected void addNewStructureViewer(AppJmol sview)
{
if (newStructureViewers != null)