예제 #1
0
 private bool isSingleElementAccess(CoreClassifier sourceType, CoreAssociationEnd associationEnd)
 {
     return
         ((sourceType.GetType() == typeof(CoreAssociationClass)) ||
          (associationEnd.isOneMultiplicity() && !associationEndHasQualifiers(associationEnd)) ||
          (associationEnd.isOneMultiplicity() && associationEndHasQualifiers(associationEnd) && getQualifiers().Count > 0));
 }
예제 #2
0
 public CoreClassifier getExpressionType(CoreClassifier sourceType, CoreAssociationEnd associationEnd, CoreClassifier elementType)
 {
     if (sourceType.GetType() == typeof(CollectionType))
     {
         if ((sourceType.GetType() == typeof(SetType) || sourceType.GetType() == typeof(BagType)) && (!associationEnd.isOrdered())
             )
         {
             return(getFactory().createBagType(elementType));
         }
         else
         {
             return(getFactory().createSequenceType(elementType));
         }
     }
     else
     {
         if (isSingleElementAccess(sourceType, associationEnd))
         {
             return(elementType);
         }
         else if (associationEnd.isOrdered())
         {
             return(getFactory().createOrderedSetType(elementType));
         }
         else
         {
             return(getFactory().createSetType(elementType));
         }
     }
 }
        public AssociationClassCallExp createAssociationClassCallExp(
            OclExpression source,
            CoreAssociationClass referredAssociationClass,
            CoreAssociationEnd navigationSource,
            List <object> qualifiers,
            bool isMarkedPre)
        {
            AssociationClassCallExpImpl exp = new AssociationClassCallExpImpl();

            exp.setFactory(this);

            exp.setReferredAssociationClass(referredAssociationClass);
            exp.setNavigationSource(navigationSource);
            exp.setSource(isMarkedPre ? createAtPreOperation(source) : source);
            if (qualifiers != null)
            {
                foreach (OclExpression qualifier in qualifiers)
                {
                    ((OclExpressionImpl)qualifier).setNavigationCallExp(exp);
                    ((AssociationClassCallExpImpl)exp).addQualifier(qualifier);
                }
            }
            CoreAssociationEnd assocEnd = navigationSource != null ? navigationSource : referredAssociationClass.lookupAssociationEnd(source.getType());

            exp.setType(((AssociationClassCallExpImpl)exp).getExpressionType(source, assocEnd, referredAssociationClass));

            ((OclExpressionImpl)source).setAppliedProperty(exp);
            return(exp);
        }
예제 #4
0
        public OclConstraint   createAssociationEndInitConstraint(string source, CoreClassifier contextualClassifier, CoreAssociationEnd assocEnd, ExpressionInOcl initialValue)
        {
            OclAssocEndInitConstraint constraint = new OclAssocEndInitConstraintImpl();

            constraint.setSource(source);
            constraint.setContextualClassifier(contextualClassifier);
            constraint.setInitializedAssocEnd(assocEnd);
            constraint.setExpression(initialValue);

            contextualClassifier.addInitConstraint(assocEnd.getName(), constraint);

//		cachedObjects.add(constraint);

            return(constraint);
        }
 /**
  * @param referredAssociationEnd The referredAssociationEnd to set.
  */
 public void setReferredAssociationEnd(
     CoreAssociationEnd referredAssociationEnd)
 {
     this.referredAssociationEnd = referredAssociationEnd;
 }
 public CoreClassifier getExpressionType(OclExpression source, CoreAssociationEnd associationEnd)
 {
     return(base.getExpressionType(source.getType(), associationEnd, associationEnd.getTheParticipant()));
 }
 public CoreClassifier getExpressionType(OclExpression source, CoreAssociationEnd associationEnd, CoreAssociationClass associationClass)
 {
     return(base.getExpressionType(source.getType(), associationEnd, associationClass));
 }
예제 #8
0
 /**
  * @param navigationSource The navigationSource to set.
  */
 public void setNavigationSource(CoreAssociationEnd navigationSource)
 {
     this.navigationSource = navigationSource;
 }
예제 #9
0
 private bool associationEndHasQualifiers(CoreAssociationEnd associationEnd)
 {
     return(associationEnd.getTheQualifiers() != null && associationEnd.getTheQualifiers().Count > 0);
 }