예제 #1
0
 @Check
 public void checkDuplicateFeatureName(final MobaQueue queue) {
   Map<String, MobaQueueFeature> _xifexpression = null;
   MobaQueue _superType = queue.getSuperType();
   boolean _notEquals = (!Objects.equal(_superType, null));
   if (_notEquals) {
     Map<String, MobaQueueFeature> _xtrycatchfinallyexpression = null;
     try {
       MobaQueue _superType_1 = queue.getSuperType();
       List<MobaQueueFeature> _allFeatures = _superType_1.getAllFeatures();
       final Function1<MobaQueueFeature, String> _function =
           (MobaQueueFeature it) -> {
             return it.getName();
           };
       _xtrycatchfinallyexpression =
           IterableExtensions.<String, MobaQueueFeature>toMap(_allFeatures, _function);
     } catch (final Throwable _t) {
       if (_t instanceof RecursionException) {
         final RecursionException ex = (RecursionException) _t;
         _xtrycatchfinallyexpression = Collections.<String, MobaQueueFeature>emptyMap();
       } else {
         throw Exceptions.sneakyThrow(_t);
       }
     }
     _xifexpression = _xtrycatchfinallyexpression;
   } else {
     _xifexpression = Collections.<String, MobaQueueFeature>emptyMap();
   }
   final Map<String, MobaQueueFeature> superFeatureMap = _xifexpression;
   final Set<String> currentFeatures = CollectionLiterals.<String>newHashSet();
   int index = 0;
   EList<MobaQueueFeature> _features = queue.getFeatures();
   for (final MobaQueueFeature feature : _features) {
     {
       String _name = feature.getName();
       boolean _containsKey = superFeatureMap.containsKey(_name);
       if (_containsKey) {
         this.error(
             "Supertype contains same feature name",
             queue,
             MobaPackage.Literals.MOBA_QUEUE__FEATURES,
             index);
       }
       String _name_1 = feature.getName();
       boolean _contains = currentFeatures.contains(_name_1);
       if (_contains) {
         this.error(
             "Feature name must be unique",
             queue,
             MobaPackage.Literals.MOBA_QUEUE__FEATURES,
             index);
       }
       String _name_2 = feature.getName();
       currentFeatures.add(_name_2);
       index++;
     }
   }
 }
예제 #2
0
 @Check
 public void checkSuperType(final MobaQueue queue) {
   MobaQueue _superType = queue.getSuperType();
   boolean _equals = Objects.equal(_superType, null);
   if (_equals) {
     return;
   }
   try {
     queue.getAllSuperTypes();
   } catch (final Throwable _t) {
     if (_t instanceof RecursionException) {
       final RecursionException ex = (RecursionException) _t;
       EObject _source = ex.getSource();
       final MobaQueue source = ((MobaQueue) _source);
       EObject _superType_1 = ex.getSuperType();
       final MobaQueue superType = ((MobaQueue) _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(), queue, MobaPackage.Literals.MOBA_QUEUE__SUPER_TYPE);
     } else {
       throw Exceptions.sneakyThrow(_t);
     }
   }
 }