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