示例#1
0
        /* (non-Javadoc)
         * @see ocl20.CoreClassifier#getMostSpecificCommonSuperType(ocl20.CoreClassifier)
         */

        public virtual CoreClassifier getMostSpecificCommonSuperType(
            CoreClassifier otherClassifier)
        {
            List <object> myAncestors    = this.getAllAncestors();
            List <object> otherAncestors = otherClassifier.getAllAncestors();

            if ((this == otherClassifier) || otherAncestors.Contains(this) ||
                OCLVOID.Equals(otherClassifier.getName()) ||
                OCLINVALID.Equals(otherClassifier.getName()))
            {
                return(this);
            }
            else if (myAncestors.Contains(otherClassifier))
            {
                return(otherClassifier);
            }
            else if (OCLVOID.Equals(this.getName()) ||
                     OCLINVALID.Equals(this.getName()))
            {
                return(otherClassifier);
            }
            else
            {
                foreach (CoreClassifier aSuperClass in otherAncestors)
                {
                    if (myAncestors.Contains(aSuperClass) || (aSuperClass == this))
                    {
                        return(aSuperClass);
                    }
                }
            }

            return((CoreClassifier)getGlobalEnvironment().lookup(OCLANY));
        }
        /* (non-Javadoc)
         * @see br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier#getInitOrDerivedConstraint(br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreModelElement)
         */
        public OclInitConstraint getInitConstraint(string elementName)
        {
            OclInitConstraint result = this.getLocalInitConstraint(elementName);

            if (result == null)
            {
                List <object> allSuperTypes = classifier.getAllAncestors();

                for (IEnumerator iter = allSuperTypes.GetEnumerator();
                     iter.MoveNext() && (result == null);)
                {
                    CoreClassifier superType = (CoreClassifier)iter.Current;
                    result = superType.getLocalInitConstraint(elementName);
                }
            }

            return(result);
        }
示例#3
0
        /* (non-Javadoc)
         * @see br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier#getInitOrDerivedConstraint(br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreModelElement)
         */
        public OclInitConstraint getInitConstraint(string elementName)
        {
            OclInitConstraint result = this.getLocalInitConstraint(elementName);

            if (result == null)
            {
                List <object> allSuperTypes = classifier.getAllAncestors();

                foreach (CoreClassifier superType in allSuperTypes)
                {
                    result = superType.getLocalInitConstraint(elementName);
                    if (result != null)
                    {
                        break;
                    }
                }
            }

            return(result);
        }