예제 #1
0
 @Check
 public void checkUseArguments(final SpeciesReference reference) {
   EList<Feature> _arguments = reference.getArguments();
   final int argSize = _arguments.size();
   Species _species = reference.getSpecies();
   EList<Feature> _parameters = _species.getParameters();
   final int paramSize = _parameters.size();
   if ((argSize == paramSize)) {
     int i = 0;
     final ComponentPart part = reference.getPart();
     while ((i < argSize)) {
       {
         Species _species_1 = reference.getSpecies();
         EList<Feature> _parameters_1 = _species_1.getParameters();
         Feature _get = _parameters_1.get(i);
         final LightweightTypeReference typeFrom = this._speADLUtils.resolveType(_get, part);
         EList<Feature> _arguments_1 = reference.getArguments();
         Feature _get_1 = _arguments_1.get(i);
         final LightweightTypeReference typeTo = this._speADLUtils.getTypeRef(_get_1);
         boolean _isAssignableFrom = typeFrom.isAssignableFrom(typeTo);
         boolean _not = (!_isAssignableFrom);
         if (_not) {
           this.error(
               ((("Incompatible types: " + typeFrom) + " is not the same or a supertype of ")
                   + typeTo),
               SpeadlPackage.Literals.SPECIES_REFERENCE__ARGUMENTS,
               i);
         }
         i = (i + 1);
       }
     }
   }
 }
예제 #2
0
 @Check
 public void checkUseArgsAgainstParameters(final SpeciesReference reference) {
   Species _species = reference.getSpecies();
   EList<Feature> _parameters = _species.getParameters();
   final int numParameters = _parameters.size();
   EList<Feature> _arguments = reference.getArguments();
   int _size = _arguments.size();
   boolean _notEquals = (numParameters != _size);
   if (_notEquals) {
     Species _species_1 = reference.getSpecies();
     String _name = _species_1.getName();
     String _plus = ("Incorrect number of arguments for species " + _name);
     String _plus_1 = (_plus + "(");
     Species _species_2 = reference.getSpecies();
     EList<Feature> _parameters_1 = _species_2.getParameters();
     final Function1<Feature, String> _function =
         new Function1<Feature, String>() {
           public String apply(final Feature it) {
             return it.getName();
           }
         };
     List<String> _map = ListExtensions.<Feature, String>map(_parameters_1, _function);
     String _join = IterableExtensions.join(_map, ",");
     String _plus_2 = (_plus_1 + _join);
     String _plus_3 = (_plus_2 + ")");
     String _plus_4 = (_plus_3 + "; it cannot be parameterized with arguments ");
     String _plus_5 = (_plus_4 + "(");
     EList<Feature> _arguments_1 = reference.getArguments();
     final Function1<Feature, String> _function_1 =
         new Function1<Feature, String>() {
           public String apply(final Feature it) {
             return it.getName();
           }
         };
     List<String> _map_1 = ListExtensions.<Feature, String>map(_arguments_1, _function_1);
     String _join_1 = IterableExtensions.join(_map_1, ",");
     String _plus_6 = (_plus_5 + _join_1);
     String _plus_7 = (_plus_6 + ")");
     this.error(_plus_7, SpeadlPackage.Literals.SPECIES_REFERENCE__ARGUMENTS);
   }
 }