lttng: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / relayd / LttngRelaydConnectionInfo.java
1 /**********************************************************************
2 * Copyright (c) 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Marc-Andre Laperle - Initial implementation
11 **********************************************************************/
12
13 package org.eclipse.linuxtools.internal.lttng2.control.ui.relayd;
14
15 /**
16 * A class that holds information about the relayd connection.
17 *
18 * @author Marc-Andre Laperle
19 * @since 3.1
20 */
21 public final class LttngRelaydConnectionInfo {
22
23 private final String fHost;
24 private final int fPort;
25 private final String fSessionName;
26
27 /**
28 * Constructs a connection information.
29 *
30 * @param host
31 * the host string
32 * @param port
33 * the port number
34 * @param sessionName
35 * the session name
36 */
37 public LttngRelaydConnectionInfo(String host, int port, String sessionName) {
38 fHost = host;
39 fPort = port;
40 fSessionName = sessionName;
41 }
42
43 /**
44 * Get the host string.
45 *
46 * @return the host string
47 */
48 public String getHost() {
49 return fHost;
50 }
51
52 /**
53 * Get the port number.
54 *
55 * @return the port number
56 */
57 public int getPort() {
58 return fPort;
59 }
60
61 /**
62 * Get the session name.
63 *
64 * @return the session name
65 */
66 public String getSessionName() {
67 return fSessionName;
68 }
69
70 @Override
71 public int hashCode() {
72 final int prime = 31;
73 int result = 1;
74 result = prime * result + ((fHost == null) ? 0 : fHost.hashCode());
75 result = prime * result + fPort;
76 result = prime * result + ((fSessionName == null) ? 0 : fSessionName.hashCode());
77 return result;
78 }
79
80 @Override
81 public boolean equals(final Object obj) {
82 if (this == obj) {
83 return true;
84 }
85 if (obj == null) {
86 return false;
87 }
88 if (getClass() != obj.getClass()) {
89 return false;
90 }
91 LttngRelaydConnectionInfo other = (LttngRelaydConnectionInfo) obj;
92 if (fHost == null) {
93 if (other.fHost != null) {
94 return false;
95 }
96 } else if (!fHost.equals(other.fHost)) {
97 return false;
98 }
99 if (fPort != other.fPort) {
100 return false;
101 }
102 if (fSessionName == null) {
103 if (other.fSessionName != null) {
104 return false;
105 }
106 } else if (!fSessionName.equals(other.fSessionName)) {
107 return false;
108 }
109 return true;
110 }
111 }
This page took 0.040005 seconds and 5 git commands to generate.