Exemplo n.º 1
0
 @Check
 public void checkStartsWithCapital(final AbstractComponent ne) {
   String _name = ne.getName();
   char _charAt = _name.charAt(0);
   boolean _isUpperCase = Character.isUpperCase(_charAt);
   boolean _not = (!_isUpperCase);
   if (_not) {
     String _switchResult = null;
     boolean _matched = false;
     if (!_matched) {
       if (ne instanceof Ecosystem) {
         _matched = true;
         _switchResult = "Ecosystem";
       }
     }
     if (!_matched) {
       if (ne instanceof Species) {
         _matched = true;
         _switchResult = "Species";
       }
     }
     final String what = _switchResult;
     this.error(
         (what + " name must start with a capital"),
         SpeadlPackage.Literals.ABSTRACT_COMPONENT__NAME);
   }
 }
Exemplo n.º 2
0
 @Check
 public void checkTypeParameterForwardReferences(final AbstractComponent c) {
   EList<JvmTypeParameter> _typeParameters = c.getTypeParameters();
   this.doCheckTypeParameterForwardReference(_typeParameters);
 }
Exemplo n.º 3
0
 @Check
 public void checkContentElementDuplicates(final AbstractComponent ac) {
   final HashSet<Pair<ContentElement, String>> names =
       CollectionLiterals.<Pair<ContentElement, String>>newHashSet();
   EList<Part> _parts = ac.getParts();
   final Function1<Part, Pair<ContentElement, String>> _function =
       new Function1<Part, Pair<ContentElement, String>>() {
         public Pair<ContentElement, String> apply(final Part it) {
           String _name = it.getName();
           return Pair.<ContentElement, String>of(((ContentElement) it), _name);
         }
       };
   List<Pair<ContentElement, String>> _map =
       ListExtensions.<Part, Pair<ContentElement, String>>map(_parts, _function);
   Iterables.<Pair<ContentElement, String>>addAll(names, _map);
   EList<ProvidedPort> _provides = ac.getProvides();
   final Function1<ProvidedPort, Pair<ContentElement, String>> _function_1 =
       new Function1<ProvidedPort, Pair<ContentElement, String>>() {
         public Pair<ContentElement, String> apply(final ProvidedPort it) {
           String _name = it.getName();
           return Pair.<ContentElement, String>of(((ContentElement) it), _name);
         }
       };
   List<Pair<ContentElement, String>> _map_1 =
       ListExtensions.<ProvidedPort, Pair<ContentElement, String>>map(_provides, _function_1);
   Iterables.<Pair<ContentElement, String>>addAll(names, _map_1);
   EList<RequiredPort> _requires = ac.getRequires();
   final Function1<RequiredPort, Pair<ContentElement, String>> _function_2 =
       new Function1<RequiredPort, Pair<ContentElement, String>>() {
         public Pair<ContentElement, String> apply(final RequiredPort it) {
           String _name = it.getName();
           return Pair.<ContentElement, String>of(((ContentElement) it), _name);
         }
       };
   List<Pair<ContentElement, String>> _map_2 =
       ListExtensions.<RequiredPort, Pair<ContentElement, String>>map(_requires, _function_2);
   Iterables.<Pair<ContentElement, String>>addAll(names, _map_2);
   final HashSet<Pair<ContentElement, String>> superNames =
       CollectionLiterals.<Pair<ContentElement, String>>newHashSet();
   Iterable<RequiredPort> _allRequires = this._speADLUtils.getAllRequires(ac);
   final Function1<RequiredPort, Pair<ContentElement, String>> _function_3 =
       new Function1<RequiredPort, Pair<ContentElement, String>>() {
         public Pair<ContentElement, String> apply(final RequiredPort it) {
           String _name = it.getName();
           return Pair.<ContentElement, String>of(((ContentElement) it), _name);
         }
       };
   Iterable<Pair<ContentElement, String>> _map_3 =
       IterableExtensions.<RequiredPort, Pair<ContentElement, String>>map(
           _allRequires, _function_3);
   Iterables.<Pair<ContentElement, String>>addAll(superNames, _map_3);
   Iterable<ProvidedPort> _allProvides = this._speADLUtils.getAllProvides(ac);
   final Function1<ProvidedPort, Pair<ContentElement, String>> _function_4 =
       new Function1<ProvidedPort, Pair<ContentElement, String>>() {
         public Pair<ContentElement, String> apply(final ProvidedPort it) {
           String _name = it.getName();
           return Pair.<ContentElement, String>of(((ContentElement) it), _name);
         }
       };
   Iterable<Pair<ContentElement, String>> _map_4 =
       IterableExtensions.<ProvidedPort, Pair<ContentElement, String>>map(
           _allProvides, _function_4);
   Iterables.<Pair<ContentElement, String>>addAll(superNames, _map_4);
   final Procedure2<Pair<ContentElement, String>, Integer> _function_5 =
       new Procedure2<Pair<ContentElement, String>, Integer>() {
         public void apply(final Pair<ContentElement, String> pn, final Integer index) {
           final ContentElement p = pn.getKey();
           final Function1<Pair<ContentElement, String>, Boolean> _function =
               new Function1<Pair<ContentElement, String>, Boolean>() {
                 public Boolean apply(final Pair<ContentElement, String> it) {
                   boolean _and = false;
                   ContentElement _key = it.getKey();
                   boolean _tripleNotEquals = (_key != p);
                   if (!_tripleNotEquals) {
                     _and = false;
                   } else {
                     String _value = it.getValue();
                     String _name = p.getName();
                     boolean _equals = Objects.equal(_value, _name);
                     _and = _equals;
                   }
                   return Boolean.valueOf(_and);
                 }
               };
           boolean _exists =
               IterableExtensions.<Pair<ContentElement, String>>exists(names, _function);
           if (_exists) {
             String _name = p.getName();
             String _plus = ("Duplicate name \'" + _name);
             String _plus_1 = (_plus + "\'");
             SpeADLValidator.this.error(_plus_1, p, SpeadlPackage.Literals.CONTENT_ELEMENT__NAME);
           } else {
             final Function1<Pair<ContentElement, String>, Boolean> _function_1 =
                 new Function1<Pair<ContentElement, String>, Boolean>() {
                   public Boolean apply(final Pair<ContentElement, String> it) {
                     boolean _and = false;
                     ContentElement _key = it.getKey();
                     boolean _tripleNotEquals = (_key != p);
                     if (!_tripleNotEquals) {
                       _and = false;
                     } else {
                       String _value = it.getValue();
                       String _name = p.getName();
                       boolean _equals = Objects.equal(_value, _name);
                       _and = _equals;
                     }
                     return Boolean.valueOf(_and);
                   }
                 };
             boolean _exists_1 =
                 IterableExtensions.<Pair<ContentElement, String>>exists(superNames, _function_1);
             if (_exists_1) {
               String _name_1 = p.getName();
               String _plus_2 = ("Duplicate name \'" + _name_1);
               String _plus_3 = (_plus_2 + "\' in specialized component");
               SpeADLValidator.this.error(
                   _plus_3, p, SpeadlPackage.Literals.CONTENT_ELEMENT__NAME);
             }
           }
         }
       };
   IterableExtensions.<Pair<ContentElement, String>>forEach(names, _function_5);
 }