Example #1
0
 @Check
 public void checkPortRefEco(final PortRef pr) {
   final AbstractComponent comp =
       EcoreUtil2.<AbstractComponent>getContainerOfType(pr, AbstractComponent.class);
   boolean _and = false;
   boolean _isEcosystem = pr.isEcosystem();
   if (!_isEcosystem) {
     _and = false;
   } else {
     _and = (!(comp instanceof Species));
   }
   if (_and) {
     this.warning(
         "The keyword \'eco\' is meant to be used in a Species",
         SpeadlPackage.Literals.PORT_REF__ECOSYSTEM);
   }
 }
Example #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);
     }
   }
 }