JAL-1551 spotlessApply
[jalview.git] / src / jalview / project / Jalview2XML.java
index a2ded9f..4a2c96e 100644 (file)
@@ -1526,7 +1526,7 @@ public class Jalview2XML
                 ov.getCanvas().getResidueColour().getRGB());
         overview.setHiddenColour(ov.getCanvas().getHiddenColour().getRGB());
         view.setOverview(overview);
-      } 
+      }
       if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)
       {
         view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(),
@@ -2307,22 +2307,24 @@ public class Jalview2XML
           line.setColour(annotation.getThreshold().colour.getRGB());
           an.setThresholdLine(line);
         }
-        if (annotation.graph==AlignmentAnnotation.CONTACT_MAP)
+        if (annotation.graph == AlignmentAnnotation.CONTACT_MAP)
         {
-          if (annotation.sequenceRef.getContactMaps()!=null)
+          if (annotation.sequenceRef.getContactMaps() != null)
           {
-            ContactMatrixI cm = annotation.sequenceRef.getContactMatrixFor(annotation);
-            if (cm!=null)
+            ContactMatrixI cm = annotation.sequenceRef
+                    .getContactMatrixFor(annotation);
+            if (cm != null)
             {
               MatrixType xmlmat = new MatrixType();
               xmlmat.setType(cm.getType());
               xmlmat.setRows(BigInteger.valueOf(cm.getWidth()));
               xmlmat.setCols(BigInteger.valueOf(cm.getHeight()));
-              // consider using an opaque to/from -> allow instance to control its representation ?
+              // consider using an opaque to/from -> allow instance to control
+              // its representation ?
               xmlmat.setElements(ContactMatrix.contactToFloatString(cm));
               if (cm.hasGroups())
               {
-                for (BitSet gp: cm.getGroups())
+                for (BitSet gp : cm.getGroups())
                 {
                   xmlmat.getGroups().add(stringifyBitset(gp));
                 }
@@ -2337,7 +2339,7 @@ public class Jalview2XML
               {
                 xmlmat.setCutHeight(cm.getCutHeight());
               }
-              
+
               // set/get properties
               if (cm instanceof MappableContactMatrixI)
               {
@@ -2478,38 +2480,44 @@ public class Jalview2XML
 
   }
 
-  private String stringifyBitset(BitSet gp) {
+  private String stringifyBitset(BitSet gp)
+  {
     StringBuilder sb = new StringBuilder();
-    for (long val:gp.toLongArray())
+    for (long val : gp.toLongArray())
     {
-      if (sb.length()>0) {
+      if (sb.length() > 0)
+      {
         sb.append(",");
       }
       sb.append(val);
     }
     return sb.toString();
   }
-  private BitSet deStringifyBitset(String stringified) {
-    if ("".equals(stringified) || stringified==null)
+
+  private BitSet deStringifyBitset(String stringified)
+  {
+    if ("".equals(stringified) || stringified == null)
     {
       return new BitSet();
     }
     String[] longvals = stringified.split(",");
     long[] newlongvals = new long[longvals.length];
-    for (int lv=0;lv<longvals.length;lv++)
+    for (int lv = 0; lv < longvals.length; lv++)
     {
-      try {
-      newlongvals[lv]=Long.valueOf(longvals[lv]);
+      try
+      {
+        newlongvals[lv] = Long.valueOf(longvals[lv]);
       } catch (Exception x)
       {
-        errorMessage+="Couldn't destringify bitset from: '"+stringified+"'";
-        newlongvals[lv]=0;
+        errorMessage += "Couldn't destringify bitset from: '" + stringified
+                + "'";
+        newlongvals[lv] = 0;
       }
     }
     return BitSet.valueOf(newlongvals);
 
-    
   }
+
   private CalcIdParam createCalcIdParam(String calcId, AlignViewport av)
   {
     AutoCalcSetting settings = av.getCalcIdSettingsFor(calcId);
@@ -2730,7 +2738,7 @@ public class Jalview2XML
     }
     return vamsasSeq;
   }
-  
+
   private Mapping createVamsasMapping(jalview.datamodel.Mapping jmp,
           SequenceI parentseq, SequenceI jds, boolean recurse)
   {
@@ -4014,7 +4022,8 @@ public class Jalview2XML
         jaa.setCalcId(annotation.getCalcId());
         if (annotation.getProperty().size() > 0)
         {
-          for (jalview.xml.binding.jalview.Property prop : annotation.getProperty())
+          for (jalview.xml.binding.jalview.Property prop : annotation
+                  .getProperty())
           {
             jaa.setProperty(prop.getName(), prop.getValue());
           }
@@ -4039,12 +4048,13 @@ public class Jalview2XML
                                   xmlmat.getCols().intValue(),
                                   xmlmat.getRows().intValue());
                   jalview.util.MapList mapping = null;
-                  if (xmlmat.getMapping()!=null)
+                  if (xmlmat.getMapping() != null)
                   {
                     MapListType m = xmlmat.getMapping();
                     // Mapping m = dr.getMapping();
                     int fr[] = new int[m.getMapListFrom().size() * 2];
-                    Iterator<MapListFrom> from = m.getMapListFrom().iterator();// enumerateMapListFrom();
+                    Iterator<MapListFrom> from = m.getMapListFrom()
+                            .iterator();// enumerateMapListFrom();
                     for (int _i = 0; from.hasNext(); _i += 2)
                     {
                       MapListFrom mf = from.next();
@@ -4060,29 +4070,35 @@ public class Jalview2XML
                       fto[_i + 1] = mf.getEnd();
                     }
 
-                    mapping = new jalview.util.MapList(fr, fto, m.getMapFromUnit().intValue(),m.getMapToUnit().intValue());
+                    mapping = new jalview.util.MapList(fr, fto,
+                            m.getMapFromUnit().intValue(),
+                            m.getMapToUnit().intValue());
                   }
-                  List<BitSet> newgroups=new ArrayList<BitSet>();
-                  if (xmlmat.getGroups().size()>0)
+                  List<BitSet> newgroups = new ArrayList<BitSet>();
+                  if (xmlmat.getGroups().size() > 0)
                   {
-                    for (String sgroup:xmlmat.getGroups())
+                    for (String sgroup : xmlmat.getGroups())
                     {
                       newgroups.add(deStringifyBitset(sgroup));
                     }
                   }
-                  String nwk=xmlmat.getNewick().size()>0 ? xmlmat.getNewick().get(0):null;
-                  if  (xmlmat.getNewick().size()>1)
+                  String nwk = xmlmat.getNewick().size() > 0
+                          ? xmlmat.getNewick().get(0)
+                          : null;
+                  if (xmlmat.getNewick().size() > 1)
                   {
                     Console.log.info(
                             "Ignoring additional clusterings for contact matrix");
                   }
-                  
+
                   String treeMethod = xmlmat.getTreeMethod();
-                  double thresh = xmlmat.getCutHeight()!=null ? xmlmat.getCutHeight() : 0;
+                  double thresh = xmlmat.getCutHeight() != null
+                          ? xmlmat.getCutHeight()
+                          : 0;
                   GroupSet grpset = new GroupSet();
                   grpset.restoreGroups(newgroups, treeMethod, nwk, thresh);
                   PAEContactMatrix newpae = new PAEContactMatrix(
-                          jaa.sequenceRef, mapping, elements,grpset);
+                          jaa.sequenceRef, mapping, elements, grpset);
                   jaa.sequenceRef.addContactListFor(jaa, newpae);
                 }
               }
@@ -4330,8 +4346,8 @@ public class Jalview2XML
    */
   protected void loadOverview(Viewport view, String version, AlignFrame af)
   {
-    if (!isVersionStringLaterThan("2.11.3",
-            version) && view.getOverview()==null)
+    if (!isVersionStringLaterThan("2.11.3", version)
+            && view.getOverview() == null)
     {
       return;
     }
@@ -4478,8 +4494,8 @@ public class Jalview2XML
         {
           if (tree.isColumnWise())
           {
-            AlignmentAnnotation aa = (AlignmentAnnotation) annotationIds.get(tree
-                    .getColumnReference());
+            AlignmentAnnotation aa = (AlignmentAnnotation) annotationIds
+                    .get(tree.getColumnReference());
             if (aa == null)
             {
               Console.warn(
@@ -5037,10 +5053,11 @@ public class Jalview2XML
     viewport.setIncrement(safeInt(view.getConsThreshold()));
     viewport.setShowJVSuffix(safeBoolean(view.isShowFullId()));
     viewport.setRightAlignIds(safeBoolean(view.isRightAlignIds()));
-    viewport.setFont(new Font(view.getFontName(),
-            safeInt(view.getFontStyle()), safeInt(view.getFontSize())),
-            (view.getCharWidth()!=null) ? false : true);
-    if (view.getCharWidth()!=null)
+    viewport.setFont(
+            new Font(view.getFontName(), safeInt(view.getFontStyle()),
+                    safeInt(view.getFontSize())),
+            (view.getCharWidth() != null) ? false : true);
+    if (view.getCharWidth() != null)
     {
       viewport.setCharWidth(view.getCharWidth());
       viewport.setCharHeight(view.getCharHeight());
@@ -5367,7 +5384,7 @@ public class Jalview2XML
               + annotationId);
       return null;
     }
-    // belt-and-braces create a threshold line if the 
+    // belt-and-braces create a threshold line if the
     // colourscheme needs one but the matchedAnnotation doesn't have one
     if (safeInt(viewAnnColour.getAboveThreshold()) != 0
             && matchedAnnotation.getThreshold() == null)