]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.project/src/org/simantics/project/features/registry/InjectedDependency.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / features / registry / InjectedDependency.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2012 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.project.features.registry;
13
14 /**
15  * @author Tuukka Lehtonen
16  */
17 public class InjectedDependency {
18
19         public final ProjectFeatureReference from;
20         public final ProjectFeatureReference to;
21
22         public InjectedDependency(ProjectFeatureReference from, ProjectFeatureReference to) {
23                 if (from == null)
24                         throw new NullPointerException("null from reference");
25                 if (to == null)
26                         throw new NullPointerException("null to reference");
27                 this.from = from;
28                 this.to = to;
29         }
30
31         @Override
32         public String toString() {
33                 return from + " -> " + to;
34         }
35
36         @Override
37         public int hashCode() {
38                 final int prime = 31;
39                 int result = 1;
40                 result = prime * result + from.hashCode();
41                 result = prime * result + to.hashCode();
42                 return result;
43         }
44
45         @Override
46         public boolean equals(Object obj) {
47                 if (this == obj)
48                         return true;
49                 if (obj == null)
50                         return false;
51                 if (getClass() != obj.getClass())
52                         return false;
53                 InjectedDependency other = (InjectedDependency) obj;
54                 return from.equals(other.from) && to.equals(other.to);
55         }
56
57 }