Example #1
0
        private MultiplicityRange createMultiplicityRange(XNamespace xnamespace, XElement xmultiplicity, Multiplicity multiplicity)
        {
            MultiplicityRange range = new MultiplicityRangeImpl();

            var xlowerinternal = xmultiplicity.Element(xnamespace + "lowerValueInternal");

            if (xlowerinternal != null)
            {
                var xlower = xlowerinternal.Element(xnamespace + "literalString");
                if (xlower != null)
                {
                    var vlower = xlower.Attribute("value").Value;
                    vlower = vlower.Equals("*") ? "-1" : vlower;
                    int lower = Convert.ToInt32(vlower);
                    range.setLower(lower);
                }
            }
            else // xlowerinternal == null (valor default)
            {
                range.setLower(1);
            }

            var xupperinternal = xmultiplicity.Element(xnamespace + "upperValueInternal");

            if (xupperinternal != null)
            {
                var xupper = xupperinternal.Element(xnamespace + "literalString");
                if (xupper != null)
                {
                    var vupper = xupper.Attribute("value").Value;
                    vupper = vupper.Equals("*") ? "-1" : vupper;
                    int upper = Convert.ToInt32(vupper);
                    range.setUpper(upper);
                }
            }
            else // xupperinternal == null (valor default)
            {
                range.setUpper(1);
            }

            range.setMultiplicity(multiplicity);
            return(range);
        }
Example #2
0
        private MultiplicityRange createMultiplicityRange(XNamespace xnamespace, XElement xmultiplicity, Multiplicity multiplicity)
        {
            var xrangenamespace = xmultiplicity.Element(xnamespace + "Multiplicity.range");

            if (xrangenamespace != null)
            {
                var xranges = xrangenamespace.Elements(xnamespace + "MultiplicityRange");
                foreach (var xrange in xranges)
                {
                    MultiplicityRange range = new MultiplicityRangeImpl();
                    int lower = Convert.ToInt32(xrange.Attribute("lower").Value);
                    range.setLower(lower);
                    int upper = Convert.ToInt32(xrange.Attribute("upper").Value);
                    range.setUpper(upper);
                    range.setMultiplicity(multiplicity);
                    return(range);
                }
            }

            return(null);
        }