1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
* SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.query.viatra.internal.rete.recipe;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.viatra.query.runtime.rete.recipes.RecipesPackage;
import org.eclipse.viatra.query.runtime.rete.recipes.ReteNodeRecipe;
import org.eclipse.viatra.query.runtime.rete.recipes.impl.AlphaRecipeImpl;
import tools.refinery.store.query.literal.Connectivity;
import java.lang.reflect.InvocationTargetException;
public class RepresentativeElectionRecipeImpl extends AlphaRecipeImpl implements RepresentativeElectionRecipe {
private Connectivity connectivity;
@Override
protected EClass eStaticClass() {
return RefineryRecipesPackage.eINSTANCE.getRepresentativeElectionRecipe();
}
@Override
public Connectivity getConnectivity() {
return connectivity;
}
@Override
public void setConnectivity(Connectivity newStrong) {
var oldConnectivity = connectivity;
connectivity = newStrong;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET,
RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__CONNECTIVITY, oldConnectivity,
connectivity));
}
}
@Override
public int getArity() {
return 2;
}
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
if (featureID == RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__CONNECTIVITY) {
return getConnectivity();
}
return super.eGet(featureID, resolve, coreType);
}
@Override
public void eSet(int featureID, Object newValue) {
if (featureID == RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__CONNECTIVITY) {
setConnectivity((Connectivity) newValue);
} else {
super.eSet(featureID, newValue);
}
}
@Override
public void eUnset(int featureID) {
if (featureID == RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__CONNECTIVITY) {
setConnectivity(null);
} else {
super.eUnset(featureID);
}
}
@Override
public boolean eIsSet(int featureID) {
if (featureID == RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__CONNECTIVITY) {
return connectivity != null;
}
return super.eIsSet(featureID);
}
@Override
public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) {
if (baseClass == ReteNodeRecipe.class && baseOperationID == RecipesPackage.RETE_NODE_RECIPE___GET_ARITY) {
return RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__GET_ARITY;
}
return super.eDerivedOperationID(baseOperationID, baseClass);
}
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
if (operationID == RefineryRecipesPackage.REPRESENTATIVE_ELECTION_RECIPE__GET_ARITY) {
return getArity();
}
return super.eInvoke(operationID, arguments);
}
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
return "%s (connectivity: %s)".formatted(super.toString(), connectivity);
}
}
|