コード例 #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));
         }
     }
 }
コード例 #3
0
        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);
        }
コード例 #5
0
 /**
  * @param referredAssociationEnd The referredAssociationEnd to set.
  */
 public void setReferredAssociationEnd(
     CoreAssociationEnd referredAssociationEnd)
 {
     this.referredAssociationEnd = referredAssociationEnd;
 }
コード例 #6
0
 public CoreClassifier getExpressionType(OclExpression source, CoreAssociationEnd associationEnd)
 {
     return(base.getExpressionType(source.getType(), associationEnd, associationEnd.getTheParticipant()));
 }
コード例 #7
0
 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);
 }