for (EdgeType typ : EdgeTypes.getAllEdgeTypes()) {
// WireSource
if (typ.getEdgeSource().isInstance(g)) {
// find the EOpposite (outWires)
EReference opposite = typ.getFromOpposite();
// get results as a list
List<Object> edges = new ArrayList<Object>();
if (opposite.isMany()) {
List<?> e2 = (List<?>) g.eGet(opposite);
for (Object e : e2)
edges.add(e);
} else {
edges.add(g.eGet(opposite));
}
for (Object edge : edges) {
// if it's a NON-generated element that has been generated, add it to the list
if (edge instanceof GeneratedElement) {
GeneratedElement edge2 = (GeneratedElement) edge;
if (!edge2.isIsGenerated()) {
EReference target = typ.getToRef();
Object reverse = edge2.eGet(target);
if (reverse == null)
continue;
if (!(reverse instanceof EObject)) {
throw new IllegalArgumentException("Object '" + reverse + "' is not an EObject, resolved reference = '" + target + "' of edgeType " + typ);
}
result.put(edge2, (EObject) reverse);
}
}
}
}
// WireDestination
if (typ.getEdgeDestination().isInstance(g)) {
// find the EOpposite (inWires)
EReference opposite = typ.getToOpposite();
// get results as a list
List<Object> edges = new ArrayList<Object>();
if (opposite.isMany()) {
List<?> e2 = (List<?>) g.eGet(opposite);
for (Object e : e2)
edges.add(e);
} else {
edges.add(g.eGet(opposite));
}
for (Object edge : edges) {
// if it's a NON-generated element that has been generated, add it to the list
if (edge instanceof GeneratedElement) {
GeneratedElement edge2 = (GeneratedElement) edge;
if (!edge2.isIsGenerated()) {
EReference target = typ.getFromRef();
Object reverse = edge2.eGet(target);
if (reverse == null)
continue;