Skip to content

Commit

Permalink
Merge 1cc4c09 into dd2db5f
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Oct 5, 2020
2 parents dd2db5f + 1cc4c09 commit bd2e98f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Expand Up @@ -134,17 +134,17 @@ public Map<EStructuralFeature, List<EStructuralFeature>> findDuplicateFeaturesIn
final Function1<Map.Entry<EStructuralFeature, List<EStructuralFeature>>, Boolean> _function = (Map.Entry<EStructuralFeature, List<EStructuralFeature>> it) -> {
return Boolean.valueOf(matcher.test(it.getKey(), f));
};
final Map.Entry<EStructuralFeature, List<EStructuralFeature>> found = IterableExtensions.<Map.Entry<EStructuralFeature, List<EStructuralFeature>>>findFirst(map.entrySet(), _function);
if ((found != null)) {
List<EStructuralFeature> _value = found.getValue();
final Map.Entry<EStructuralFeature, List<EStructuralFeature>> existing = IterableExtensions.<Map.Entry<EStructuralFeature, List<EStructuralFeature>>>findFirst(map.entrySet(), _function);
if ((existing != null)) {
List<EStructuralFeature> _value = existing.getValue();
_value.add(f);
} else {
map.put(f, CollectionLiterals.<EStructuralFeature>newArrayList(f));
}
}
}
final Function2<EStructuralFeature, List<EStructuralFeature>, Boolean> _function = (EStructuralFeature p1, List<EStructuralFeature> p2) -> {
int _size = p2.size();
final Function2<EStructuralFeature, List<EStructuralFeature>, Boolean> _function = (EStructuralFeature key, List<EStructuralFeature> values) -> {
int _size = values.size();
return Boolean.valueOf((_size > 1));
};
return MapExtensions.<EStructuralFeature, List<EStructuralFeature>>filter(map, _function);
Expand Down
Expand Up @@ -101,15 +101,15 @@ def findDuplicateFeatures(EPackage ePackage) {
def findDuplicateFeaturesInCollection(Collection<EStructuralFeature> features, BiPredicate<EStructuralFeature, EStructuralFeature> matcher) {
val map = <EStructuralFeature, List<EStructuralFeature>>newLinkedHashMap
for (f : features) {
val found = map.entrySet.findFirst[matcher.test(it.key, f)]
if (found !== null) {
found.value += f
val existing = map.entrySet.findFirst[matcher.test(it.key, f)]
if (existing !== null) {
existing.value += f
} else {
map.put(f, newArrayList(f))
}
}
// only entries with a mapped list of size > 1 are duplicates
return map.filter[p1, p2| p2.size > 1]
return map.filter[key, values| values.size > 1]
}

/**
Expand Down
Expand Up @@ -122,9 +122,9 @@ def extractSuperclass(List<? extends EStructuralFeature> duplicates){

for (duplicate : duplicates) {
duplicate.EContainingClass => [
// set supertype of the EClass of the attribute
// set supertype of the EClass of the feature
addESuperType(superclass)
// and then remove the attribute from the original EClass
// and then remove the feature from the original EClass
EStructuralFeatures -= duplicate
]
}
Expand Down

0 comments on commit bd2e98f

Please sign in to comment.