]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/nodes/ConnectionNode.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.structural.ui / src / org / simantics / structural / ui / modelBrowser / nodes / ConnectionNode.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.structural.ui.modelBrowser.nodes;\r
13 \r
14 import org.simantics.db.Resource;\r
15 \r
16 public class ConnectionNode {\r
17 \r
18     public final Resource connection;\r
19     public final Resource composite;\r
20 \r
21     public ConnectionNode(Resource connection, Resource composite) {\r
22         this.connection = connection;\r
23         this.composite = composite;\r
24     }\r
25 \r
26     @Override\r
27     public int hashCode() {\r
28         final int prime = 31;\r
29         int result = 1;\r
30         result = prime * result\r
31                 + ((composite == null) ? 0 : composite.hashCode());\r
32         result = prime * result\r
33                 + ((connection == null) ? 0 : connection.hashCode());\r
34         return result;\r
35     }\r
36 \r
37     @Override\r
38     public boolean equals(Object obj) {\r
39         if (this == obj)\r
40             return true;\r
41         if (obj == null)\r
42             return false;\r
43         if (getClass() != obj.getClass())\r
44             return false;\r
45         ConnectionNode other = (ConnectionNode) obj;\r
46         if (composite == null) {\r
47             if (other.composite != null)\r
48                 return false;\r
49         } else if (!composite.equals(other.composite))\r
50             return false;\r
51         if (connection == null) {\r
52             if (other.connection != null)\r
53                 return false;\r
54         } else if (!connection.equals(other.connection))\r
55             return false;\r
56         return true;\r
57     }\r
58 \r
59 }\r