diff options
Diffstat (limited to 'subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java')
-rw-r--r-- | subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java new file mode 100644 index 00000000..f9b05e5b --- /dev/null +++ b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java | |||
@@ -0,0 +1,55 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2015, Bergmann Gabor, Istvan Rath and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.viatra.runtime.matchers.context.common; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | ||
12 | |||
13 | |||
14 | /** | ||
15 | * An input key that is identified by a single wrapped object and the class of the wrapper. | ||
16 | * @author Bergmann Gabor | ||
17 | * | ||
18 | */ | ||
19 | public abstract class BaseInputKeyWrapper<Wrapped> implements IInputKey { | ||
20 | protected Wrapped wrappedKey; | ||
21 | |||
22 | public BaseInputKeyWrapper(Wrapped wrappedKey) { | ||
23 | super(); | ||
24 | this.wrappedKey = wrappedKey; | ||
25 | } | ||
26 | |||
27 | public Wrapped getWrappedKey() { | ||
28 | return wrappedKey; | ||
29 | } | ||
30 | |||
31 | |||
32 | @Override | ||
33 | public int hashCode() { | ||
34 | return ((wrappedKey == null) ? 0 : wrappedKey.hashCode()); | ||
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 (!(this.getClass().equals(obj.getClass()))) | ||
44 | return false; | ||
45 | BaseInputKeyWrapper other = (BaseInputKeyWrapper) obj; | ||
46 | if (wrappedKey == null) { | ||
47 | if (other.wrappedKey != null) | ||
48 | return false; | ||
49 | } else if (!wrappedKey.equals(other.wrappedKey)) | ||
50 | return false; | ||
51 | return true; | ||
52 | } | ||
53 | |||
54 | |||
55 | } | ||