applied LGPLv3 and source code formatting.
[vamsas.git] / src / uk / ac / vamsas / client / picking / SelectionMessage.java
index d611437..32289aa 100644 (file)
@@ -1,5 +1,23 @@
-/**\r
+/*\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.client.picking;\r
 \r
@@ -22,7 +40,8 @@ public class SelectionMessage extends Message {
 \r
   RangeType ranges;\r
 \r
-  private boolean none=false;\r
+  private boolean none = false;\r
+\r
   /**\r
    * parse a message payload as a selection message\r
    * \r
@@ -44,13 +63,11 @@ public class SelectionMessage extends Message {
       if (elements[i].startsWith("ranges=")) {\r
         segs = elements[i].substring(7).split(",");\r
       }\r
-      if (elements[i].equals("none"))\r
-      {\r
-        none=true;\r
+      if (elements[i].equals("none")) {\r
+        none = true;\r
       }\r
     }\r
-    if (none)\r
-    {\r
+    if (none) {\r
       ranges = null;\r
       vorbaIDs = null;\r
     }\r
@@ -85,20 +102,22 @@ public class SelectionMessage extends Message {
   /**\r
    * create a new selection message\r
    * \r
-   * @param selectionID -\r
-   *          (may be null) optional handle (or ID) to refer to selection by\r
-   * @param vorbaIDs -\r
-   *          one or more objects to be selected, or null for the empty selection\r
+   * @param selectionID\r
+   *          - (may be null) optional handle (or ID) to refer to selection by\r
+   * @param vorbaIDs\r
+   *          - one or more objects to be selected, or null for the empty\r
+   *          selection\r
    * @param ranges\r
    *          optional rangetype specifying positions or intervals over\r
    *          object(s) coordinate system.\r
    */\r
   public SelectionMessage(String selectionID, String[] vorbaIDs,\r
       RangeType ranges) {\r
-    this(selectionID,vorbaIDs,ranges,false);\r
+    this(selectionID, vorbaIDs, ranges, false);\r
   }\r
-  public SelectionMessage(String selectionID, String[] vorbaIDs, RangeType ranges, boolean none)\r
-  {\r
+\r
+  public SelectionMessage(String selectionID, String[] vorbaIDs,\r
+      RangeType ranges, boolean none) {\r
     super();\r
     this.selectionID = selectionID;\r
     if (selectionID != null && selectionID.indexOf("\t") > -1) {\r
@@ -107,7 +126,7 @@ public class SelectionMessage extends Message {
     }\r
     this.vorbaIDs = vorbaIDs;\r
     this.ranges = ranges;\r
-    this.none=none;\r
+    this.none = none;\r
     StringBuffer message = new StringBuffer();\r
     message.append("SELECTION\t");\r
     if (selectionID != null) {\r
@@ -132,21 +151,22 @@ public class SelectionMessage extends Message {
     }\r
     if (none) {\r
       // must have only IDs for the selection or the selection scope - no range\r
-      if (ranges!=null)\r
-      {\r
+      if (ranges != null) {\r
         throw new Error("Empty selection cannot specify a range.");\r
       }\r
-      if ((selectionID==null || selectionID.length()==0) && (vorbaIDs==null || vorbaIDs.length==0))\r
-      {\r
-        throw new Error("Empty selection must have at least a selection ID or at least one vorbaID indicating selection scope.");\r
+      if ((selectionID == null || selectionID.length() == 0)\r
+          && (vorbaIDs == null || vorbaIDs.length == 0)) {\r
+        throw new Error(\r
+            "Empty selection must have at least a selection ID or at least one vorbaID indicating selection scope.");\r
       }\r
       message.append("none");\r
       return;\r
-    } \r
-    // Verify that the range has at least one valid vorbaID for it to be defined on.\r
-    if (vorbaIDs==null || vorbaIDs.length==0)\r
-    {\r
-      throw new Error("You must specify at least one vorbaID for the selection.");\r
+    }\r
+    // Verify that the range has at least one valid vorbaID for it to be defined\r
+    // on.\r
+    if (vorbaIDs == null || vorbaIDs.length == 0) {\r
+      throw new Error(\r
+          "You must specify at least one vorbaID for the selection.");\r
     }\r
     if (ranges != null) {\r
       if (ranges.getPosCount() > 0) {\r