]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/reference/ComponentReference.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / accessor / reference / ComponentReference.java
1 /*******************************************************************************\r
2  *  Copyright (c) 2010 Association for Decentralized Information Management in\r
3  *  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.databoard.accessor.reference;
13
14
15 /**
16  * Component "value"
17  *
18  * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
19  */
20 public class ComponentReference extends ChildReference {
21
22         public ComponentReference() {
23         }
24
25         public ComponentReference(ChildReference child) {
26                 super(child);
27         }
28 \r
29         @Override\r
30         public String toString(boolean labelReference) {\r
31                 return "v";\r
32         }\r
33         
34         @Override
35         public ChildReference clone() {
36                 return new ComponentReference(childReference==null ? null : childReference.clone());
37         }       \r
38         
39         @Override\r
40         public boolean equals(Object obj) {\r
41                 if (obj instanceof ComponentReference == false) return false;\r
42                 ComponentReference other = (ComponentReference) obj;\r
43                 if (other.hasChildReference() != hasChildReference()) return false;\r
44                 if (hasChildReference() && !other.childReference.equals(childReference)) return false;\r
45                 return true;\r
46         }\r
47         \r
48         @Override\r
49         public int hashCode() {\r
50                 int hash = -8882;\r
51                 if (hasChildReference()) hash = 31*hash + childReference.hashCode();            \r
52                 return hash;\r
53         }       
54 }
55