Exemplo n.º 1
0
        /* (non-Javadoc)
         * @see br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier#conformsTo(br.cos.ufrj.lens.odyssey.tools.psw.metamodels.core.interfaces.CoreClassifier)
         */
        public override bool conformsTo(CoreClassifier c)
        {
            if (c.getName().Equals("OclAny"))
            {
                return(true);
            }

            if (!(c is TupleTypeImpl))
            {
                return(false);
            }

            TupleType typeToMatch = (TupleType)c;

            if (this.getTupleParts().Count != typeToMatch.getTupleParts().Count)
            {
                return(false);
            }

            List <object> tupleTypes = new List <object>(getTupleParts());

            for (int i = 0; i < tupleTypes.Count; i++)
            {
                TuplePartType element      = (TuplePartType)tupleTypes[i];
                CoreAttribute elementFound = typeToMatch.lookupAttribute(element.getName());
                if (elementFound == null || !element.getFeatureType().conformsTo(elementFound.getFeatureType()))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public void test_09()
        {
            String         stream = "Tuple(a : Film,  b : String, c : Integer)";
            CoreClassifier c      = doParseTestOK(stream, this.getCurrentMethodName(), "Tuple(a : Film, b : String, c : Integer)", typeof(TupleType));
            TupleType      tuple  = (TupleType)c;
            List <object>  parts  = tuple.getTupleParts();

            Assert.AreEqual(3, parts.Count);
        }