applied LGPLv3 and source code formatting.
[vamsas.git] / src / uk / ac / vamsas / client / ClientHandle.java
index b566c8d..4d0f936 100644 (file)
@@ -1,4 +1,23 @@
 /*
+ * This file is part of the Vamsas Client version 0.1. 
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, 
+ *  Andrew Waterhouse and Dominik Lindner.
+ * 
+ * Earlier versions have also been incorporated into Jalview version 2.4 
+ * since 2008, and TOPALi version 2 since 2007.
+ * 
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *  
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client.  If not, see <http://www.gnu.org/licenses/>.
  */
 package uk.ac.vamsas.client;
 
@@ -6,11 +25,12 @@ import java.io.Serializable;
 
 /**
  * Uniquely describes a vamsas client application.
- * @author jimp 
+ * 
+ * @author jimp
  */
 public class ClientHandle implements Serializable {
   static final long serialVersionUID = 0;
-  
+
   /**
    * @param clientName
    * @param version
@@ -19,19 +39,21 @@ public class ClientHandle implements Serializable {
     super();
     this.clientName = _clientName;
     this.version = _version;
-    //this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO: decide on application handle ornthing (used to prefix new ids made by a particular application)
+    // this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO:
+    // decide on application handle ornthing (used to prefix new ids made by a
+    // particular application)
     this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
   }
+
   /**
    * (non-unique) human readable vamsas client name
    */
   String clientName;
 
   /**
-   * the unambiguous client identifier
-   * This may be rewritten by the Vorba object if
-   * other clients with the same name, version 
-   * and user are involved in a session.
+   * the unambiguous client identifier This may be rewritten by the Vorba object
+   * if other clients with the same name, version and user are involved in a
+   * session.
    * 
    */
   String clientUrn;
@@ -43,16 +65,17 @@ public class ClientHandle implements Serializable {
 
   /**
    * Generates the client Urn from the clientName and version
-   *  
-   * @param clientName (non-unique) human readable vamsas client name
-   * @param version version modifier
+   * 
+   * @param clientName
+   *          (non-unique) human readable vamsas client name
+   * @param version
+   *          version modifier
    * @return a String corresponding to the clientUrn
    */
-  private String  generateClientUrn(String _clientName, String  _version)
-    {
-      return ("vamsas://"+_clientName+":"+_version+"/").intern();
-    }
-  
+  private String generateClientUrn(String _clientName, String _version) {
+    return ("vamsas://" + _clientName + ":" + _version + "/").intern();
+  }
+
   /**
    * @return Returns the clientUrn.
    */
@@ -62,6 +85,7 @@ public class ClientHandle implements Serializable {
 
   /**
    * May become protected - should only be set by a Vorba object.
+   * 
    * @param clientUrn
    *          The clientUrn to set.
    */
@@ -85,7 +109,6 @@ public class ClientHandle implements Serializable {
     this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
   }
 
-
   /**
    * @return Returns the clientName.
    */
@@ -104,17 +127,18 @@ public class ClientHandle implements Serializable {
 
   public boolean equals(Object that) {
     if (that instanceof ClientHandle)
-      return this.equals((ClientHandle) that); 
+      return this.equals((ClientHandle) that);
     return false;
   }
+
   public boolean equals(ClientHandle that) {
-    return ( (this.clientName == null || this.clientName.equals(that.clientName)) 
-        && (this.version == null || this.version.equals(that.version)) 
-        && (this.clientUrn == null || this.clientUrn.equals(that.clientUrn)));
+    return ((this.clientName == null || this.clientName.equals(that.clientName))
+        && (this.version == null || this.version.equals(that.version)) && (this.clientUrn == null || this.clientUrn
+        .equals(that.clientUrn)));
   }
 
   public String getClientNCname() {
-    
+
     String ncname = clientName.replace(':', '_');
     ncname = ncname.replace('@', '.');
     return ncname;