Exemple #1
0
 @Check
 public void checkBound(final Part ci) {
   AbstractComponent _abstractComponent = this._speADLUtils.abstractComponent(ci);
   Iterable<RequiredPort> _allRequires = this._speADLUtils.getAllRequires(_abstractComponent);
   final Set<RequiredPort> toBind = IterableExtensions.<RequiredPort>toSet(_allRequires);
   EList<Binding> _bindings = ci.getBindings();
   final Function1<Binding, RequiredPort> _function =
       new Function1<Binding, RequiredPort>() {
         public RequiredPort apply(final Binding it) {
           return it.getFrom();
         }
       };
   List<RequiredPort> _map = ListExtensions.<Binding, RequiredPort>map(_bindings, _function);
   final Set<RequiredPort> bound = IterableExtensions.<RequiredPort>toSet(_map);
   toBind.removeAll(bound);
   boolean _isEmpty = toBind.isEmpty();
   boolean _not = (!_isEmpty);
   if (_not) {
     this.error(
         "Missing bindings for required ports", SpeadlPackage.Literals.CONTENT_ELEMENT__NAME);
   }
 }
Exemple #2
0
 /**
  * See checkLocalUsageOfDeclaredFields for hilighting unbinded part! And
  * checkNonInitializedFieldsHaveAType if we want to infer type of already bound provides, would be
  * nice...
  */
 @Check
 public void checkPortRef(final PortRef pr) {
   boolean _or = false;
   Port _port = pr.getPort();
   boolean _tripleEquals = (_port == null);
   if (_tripleEquals) {
     _or = true;
   } else {
     Port _port_1 = pr.getPort();
     boolean _eIsProxy = _port_1.eIsProxy();
     _or = _eIsProxy;
   }
   if (_or) {
     return;
   }
   boolean _and = false;
   Part _part = pr.getPart();
   boolean _tripleNotEquals = (_part != null);
   if (!_tripleNotEquals) {
     _and = false;
   } else {
     Part _part_1 = pr.getPart();
     boolean _eIsProxy_1 = _part_1.eIsProxy();
     _and = _eIsProxy_1;
   }
   if (_and) {
     return;
   }
   final LightweightTypeReference typeTo = this._speADLUtils.resolveType(pr);
   LightweightTypeReference _switchResult = null;
   EObject _eContainer = pr.eContainer();
   final EObject cont = _eContainer;
   boolean _matched = false;
   if (!_matched) {
     if (cont instanceof Binding) {
       _matched = true;
       _switchResult = this._speADLUtils.resolveTypeFrom(((Binding) cont));
     }
   }
   if (!_matched) {
     if (cont instanceof ProvidedPort) {
       _matched = true;
       JvmParameterizedTypeReference _typeReference = ((ProvidedPort) cont).getTypeReference();
       Resource _eResource = pr.eResource();
       _switchResult = this._speADLUtils.toLightweightTypeReference(_typeReference, _eResource);
     }
   }
   final LightweightTypeReference typeFrom = _switchResult;
   boolean _and_1 = false;
   boolean _tripleNotEquals_1 = (typeFrom != null);
   if (!_tripleNotEquals_1) {
     _and_1 = false;
   } else {
     boolean _tripleNotEquals_2 = (typeTo != null);
     _and_1 = _tripleNotEquals_2;
   }
   if (_and_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.PORT_REF__PORT);
     }
   }
 }