@Check public void checkDuplicateFeatureName(final MobaEntity dto) { Map<String, MobaEntityFeature> _xifexpression = null; MobaEntity _superType = dto.getSuperType(); boolean _notEquals = (!Objects.equal(_superType, null)); if (_notEquals) { Map<String, MobaEntityFeature> _xtrycatchfinallyexpression = null; try { MobaEntity _superType_1 = dto.getSuperType(); List<MobaEntityFeature> _allFeatures = _superType_1.getAllFeatures(); final Function1<MobaEntityFeature, String> _function = (MobaEntityFeature it) -> { return it.getName(); }; _xtrycatchfinallyexpression = IterableExtensions.<String, MobaEntityFeature>toMap(_allFeatures, _function); } catch (final Throwable _t) { if (_t instanceof RecursionException) { final RecursionException ex = (RecursionException) _t; _xtrycatchfinallyexpression = Collections.<String, MobaEntityFeature>emptyMap(); } else { throw Exceptions.sneakyThrow(_t); } } _xifexpression = _xtrycatchfinallyexpression; } else { _xifexpression = Collections.<String, MobaEntityFeature>emptyMap(); } final Map<String, MobaEntityFeature> superFeatureMap = _xifexpression; final Set<String> currentFeatures = CollectionLiterals.<String>newHashSet(); int index = 0; EList<MobaEntityFeature> _features = dto.getFeatures(); for (final MobaEntityFeature feature : _features) { { String _name = feature.getName(); boolean _containsKey = superFeatureMap.containsKey(_name); if (_containsKey) { this.error( "Supertype contains same feature name", dto, MobaPackage.Literals.MOBA_ENTITY__FEATURES, index); } String _name_1 = feature.getName(); boolean _contains = currentFeatures.contains(_name_1); if (_contains) { this.error( "Feature name must be unique", dto, MobaPackage.Literals.MOBA_ENTITY__FEATURES, index); } String _name_2 = feature.getName(); currentFeatures.add(_name_2); index++; } } }
@Check public void checkSuperType(final MobaEntity dto) { MobaEntity _superType = dto.getSuperType(); boolean _equals = Objects.equal(_superType, null); if (_equals) { return; } try { dto.getAllSuperTypes(); } catch (final Throwable _t) { if (_t instanceof RecursionException) { final RecursionException ex = (RecursionException) _t; EObject _source = ex.getSource(); final MobaEntity source = ((MobaEntity) _source); EObject _superType_1 = ex.getSuperType(); final MobaEntity superType = ((MobaEntity) _superType_1); StringConcatenation _builder = new StringConcatenation(); _builder.append("Recursive supertypes for "); String _name = source.getName(); _builder.append(_name, ""); _builder.append(" --> "); String _name_1 = superType.getName(); _builder.append(_name_1, ""); this.error(_builder.toString(), dto, MobaPackage.Literals.MOBA_ENTITY__SUPER_TYPE); } else { throw Exceptions.sneakyThrow(_t); } } }