]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ServerAddress.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.server / src / org / simantics / db / server / internal / ServerAddress.java
index 704d093ff5cfa2ddddda9b46e51c80dc847e3397..01eaadf830e72c1573cb14e693ad943fa1b1958a 100644 (file)
@@ -1,91 +1,91 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementatio\r
- *******************************************************************************/\r
-package org.simantics.db.server.internal;\r
-\r
-import java.net.InetSocketAddress;\r
-\r
-/**\r
- * @author J-P Laine\r
- */\r
-public class ServerAddress {\r
-    private InetSocketAddress socketAddress;\r
-    private String dbid;\r
-\r
-    public ServerAddress(String hostAndPort, String dbid) {\r
-        this(hostAndPort);\r
-        this.dbid = dbid;\r
-    }\r
-\r
-    public ServerAddress(String hostAndPort) {\r
-        assert (hostAndPort != null);\r
-\r
-        String[] split = hostAndPort.split(":");\r
-        if (split.length != 2)\r
-            throw new IllegalArgumentException("address does not contain a port, missing ':' character");\r
-        this.socketAddress = InetSocketAddress.createUnresolved(split[0], Integer.parseInt(split[1]));\r
-        this.dbid = null;\r
-    }\r
-\r
-    public ServerAddress(String host, int port) {\r
-        assert (host != null);\r
-        this.socketAddress = new InetSocketAddress(host, port);\r
-        this.dbid = null;\r
-    }\r
-\r
-    public ServerAddress(String host, int port, String dbid) {\r
-        assert (host != null);\r
-        this.socketAddress = InetSocketAddress.createUnresolved(host, port);\r
-        this.dbid = dbid;\r
-    }\r
-\r
-    public ServerAddress(InetSocketAddress socketAddress) {\r
-        assert (socketAddress != null);\r
-        this.socketAddress = socketAddress;\r
-        this.dbid = null;\r
-    }\r
-\r
-    public ServerAddress(InetSocketAddress socketAddress, String dbid) {\r
-        assert (socketAddress != null);\r
-        this.socketAddress = socketAddress;\r
-        this.dbid = dbid;\r
-    }\r
-\r
-    public InetSocketAddress getAddress() {\r
-        return socketAddress;\r
-    }\r
-\r
-    public String getDbid() {\r
-        return dbid;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        return socketAddress.hashCode();\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object other) {\r
-        if (this == other) return true;\r
-        if (other == null || !(getClass().equals(other.getClass()))) return false;\r
-        ServerAddress r = (ServerAddress) other;\r
-        return r.socketAddress.equals(socketAddress) && (r.dbid != null && r.dbid.equals(dbid) || r.dbid == null && dbid == null);\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        if(dbid != null) {\r
-            return socketAddress.toString()+" / "+dbid;\r
-        } else {\r
-            return socketAddress.toString();\r
-        }\r
-    }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementatio
+ *******************************************************************************/
+package org.simantics.db.server.internal;
+
+import java.net.InetSocketAddress;
+
+/**
+ * @author J-P Laine
+ */
+public class ServerAddress {
+    private InetSocketAddress socketAddress;
+    private String dbid;
+
+    public ServerAddress(String hostAndPort, String dbid) {
+        this(hostAndPort);
+        this.dbid = dbid;
+    }
+
+    public ServerAddress(String hostAndPort) {
+        assert (hostAndPort != null);
+
+        String[] split = hostAndPort.split(":");
+        if (split.length != 2)
+            throw new IllegalArgumentException("address does not contain a port, missing ':' character");
+        this.socketAddress = InetSocketAddress.createUnresolved(split[0], Integer.parseInt(split[1]));
+        this.dbid = null;
+    }
+
+    public ServerAddress(String host, int port) {
+        assert (host != null);
+        this.socketAddress = new InetSocketAddress(host, port);
+        this.dbid = null;
+    }
+
+    public ServerAddress(String host, int port, String dbid) {
+        assert (host != null);
+        this.socketAddress = InetSocketAddress.createUnresolved(host, port);
+        this.dbid = dbid;
+    }
+
+    public ServerAddress(InetSocketAddress socketAddress) {
+        assert (socketAddress != null);
+        this.socketAddress = socketAddress;
+        this.dbid = null;
+    }
+
+    public ServerAddress(InetSocketAddress socketAddress, String dbid) {
+        assert (socketAddress != null);
+        this.socketAddress = socketAddress;
+        this.dbid = dbid;
+    }
+
+    public InetSocketAddress getAddress() {
+        return socketAddress;
+    }
+
+    public String getDbid() {
+        return dbid;
+    }
+
+    @Override
+    public int hashCode() {
+        return socketAddress.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) return true;
+        if (other == null || !(getClass().equals(other.getClass()))) return false;
+        ServerAddress r = (ServerAddress) other;
+        return r.socketAddress.equals(socketAddress) && (r.dbid != null && r.dbid.equals(dbid) || r.dbid == null && dbid == null);
+    }
+
+    @Override
+    public String toString() {
+        if(dbid != null) {
+            return socketAddress.toString()+" / "+dbid;
+        } else {
+            return socketAddress.toString();
+        }
+    }
+}