public bool hasMatchingSignature(List <object> pParamTypes)
        {
            CollectionType ownerCollection = (CollectionType)getFeatureOwner();
            List <object>  parameters      = new List <object>(getParametersTypesExceptReturn());

            if (parameters.Count == 0 && pParamTypes == null)
            {
                return(true);
            }

            if (parameters.Count != pParamTypes.Count)
            {
                return(false);
            }

            List <object> paramTypes = new List <object>(pParamTypes);

            for (int i = 0; i < parameters.Count; i++)
            {
                CoreClassifier parameter       = (CoreClassifier)parameters[i];
                CoreClassifier typeToBeMatched = (CoreClassifier)paramTypes[i];

                if (parameter.getName().Equals("<T>"))
                {
                    if (!typeToBeMatched.conformsTo(ownerCollection.getElementType()) && !ownerCollection.getElementType().getName().Equals("OclVoid"))
                    {
                        return(false);
                    }
                }
                else if (OclTypesDefinition.isOclGenericCollectionType(parameter.getName()))
                {
                    parameter = getParameterRealType(parameter, typeToBeMatched);

                    if (parameter == null || (!typeToBeMatched.conformsTo(parameter) && !parameter.getName().Equals("OclVoid")))
                    {
                        return(false);
                    }
                }
                else if (!typeToBeMatched.conformsTo(parameter) && !ownerCollection.getElementType().getName().Equals("OclVoid"))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
 /* (non-Javadoc)
  * @see br.ufrj.cos.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier#getMostSpecificCommonSuperType(br.ufrj.cos.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier)
  */
 public override CoreClassifier getMostSpecificCommonSuperType(CoreClassifier otherClassifier)
 {
     if (this.conformsTo(otherClassifier))
     {
         return(otherClassifier);
     }
     else if (otherClassifier.conformsTo(this))
     {
         return(this);
     }
     else
     {
         return((CoreClassifier)OclTypesDefinition.getType("OclAny"));
     }
 }
示例#3
0
            /* (non-Javadoc)
             * @see implocl20.CoreOperationImpl.ParameterRuleEvaluator#evaluate(ocl20.CoreClassifier, ocl20.CoreClassifier)
             */

            public bool evaluate(CoreClassifier argumentType, CoreClassifier parameterType)
            {
                return(argumentType.conformsTo(parameterType));
            }