public override void visit(Generated.ReqRelated obj, bool visitSubNodes)
        {
            ReqRelated init       = obj as ReqRelated;
            ReqRelated reqRelated = obj as ReqRelated;

            if (init != null && init.NeedsRequirement) // the object must be associated to a requirement
            {
                bool noReq = true;                     // no requirement found for this object
                while (noReq && reqRelated != null)
                {
                    for (int i = 0; i < reqRelated.Requirements.Count; i++)
                    {
                        ReqRef reqRef = reqRelated.Requirements[i] as ReqRef;
                        if (reqRef.Paragraph == null)
                        {
                            reqRef.AddError("Cannot find paragraph corresponding to " + reqRef.getId());
                        }
                        else if (reqRef.Paragraph.getType() == Generated.acceptor.Paragraph_type.aREQUIREMENT)
                        {
                            noReq = false;  // found a requirement
                        }
                    }
                    if (noReq)  // if no requirement found, we explore the requirements of the enclosing element
                    {
                        reqRelated = Utils.EnclosingFinder <DataDictionary.ReqRelated> .find(reqRelated);
                    }
                }
                if (noReq)
                {
                    init.AddInfo("No requirement found for element");
                }
            }

            base.visit(obj, visitSubNodes);
        }
Esempio n. 2
0
            /// <summary>
            ///     Update references to paragraphs
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="visitSubNodes"></param>
            public override void visit(Generated.ReqRef obj, bool visitSubNodes)
            {
                ReqRef reqRef = (ReqRef)obj;

                if (UpdateGuid)
                {
                    Specification.Paragraph paragraph = reqRef.Paragraph;
                    if (paragraph != null)
                    {
                        // Updates the paragraph Guid
                        if (paragraph.Guid != reqRef.getId())
                        {
                            reqRef.setId(paragraph.getGuid());
                        }

                        // Updates the specification Guid
                        Specification.Specification specification =
                            EnclosingFinder <Specification.Specification> .find(paragraph);

                        if (specification.Guid != reqRef.getSpecId())
                        {
                            reqRef.setSpecId(specification.Guid);
                        }
                    }
                }

                base.visit(obj, visitSubNodes);
            }
Esempio n. 3
0
        public override Generated.ReqRef createReqRef()
        {
            Generated.ReqRef retVal = new ReqRef();

            _defaultValueSetter.SetDefaultValue(retVal);
            return(retVal);
        }
Esempio n. 4
0
        /// <summary>
        ///     Adds a model element in this model element
        /// </summary>
        /// <param name="copy"></param>
        public override void AddModelElement(IModelElement element)
        {
            ReqRef reqRef = element as ReqRef;

            if (reqRef != null)
            {
                appendRequirements(reqRef);
            }
        }
        public override void visit(Generated.ReqRef obj, bool visitSubNodes)
        {
            ReqRef reqRef = obj as ReqRef;

            if (reqRef != null)
            {
                if (reqRef.Paragraph == null)
                {
                    reqRef.AddError("Invalid reference to a requirement (" + reqRef.getId() + ")");
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///     Creates an update for the reqref. Used to delete references in an update.
        /// </summary>
        /// <param name="modelUpdate"></param>
        /// <returns></returns>
        public ReqRef CreateReqRefUpdate(ModelElement modelUpdate)
        {
            ReqRef retVal = (ReqRef)Duplicate();

            retVal.setUpdates(Guid);
            ReqRelated reqRelatedUpdate = modelUpdate as ReqRelated;

            if (reqRelatedUpdate != null)
            {
                reqRelatedUpdate.appendRequirements(retVal);
            }


            return(retVal);
        }
            public override void visit(XmlBooster.IXmlBBase obj, bool visitSubNodes)
            {
                ReqRef reqRef = obj as ReqRef;

                if (reqRef != null)
                {
                    if (reqRef.Paragraph != null)
                    {
                        if (!ParagraphsReqRefs.ContainsKey(reqRef.Paragraph))
                        {
                            ParagraphsReqRefs.Add(reqRef.Paragraph, new List <ReqRef>());
                        }
                        paragraphsReqRefs[reqRef.Paragraph].Add(reqRef);
                    }
                }
            }
        public override void visit(Generated.ReqRef obj, bool visitSubNodes)
        {
            ReqRef req = (ReqRef)obj;

            Specification.Paragraph paragraph = req.Paragraph;
            if (paragraph != null && paragraph.getImplementationStatus() == Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented)
            {
                currentSet.Add(paragraph);

                // Keep track of this req ref
                if (!paragraphCache.ContainsKey(paragraph))
                {
                    paragraphCache[paragraph] = new HashSet <ReqRef>();
                }
                paragraphCache[paragraph].Add(req);
            }
            base.visit(obj, visitSubNodes);
        }
Esempio n. 9
0
        /// <summary>
        ///     Creates are reference to a requirement. If already exists, returns that reference
        /// </summary>
        /// <param name="paragraph"></param>
        /// <returns>the req ref created</returns>
        public ReqRef FindOrCreateReqRef(Paragraph paragraph)
        {
            ReqRef retVal = null;

            foreach (ReqRef reqRef in Requirements)
            {
                if (reqRef.Paragraph == paragraph)
                {
                    retVal = reqRef;
                    break;
                }
            }

            if (retVal == null)
            {
                ReqRef req = (ReqRef)acceptor.getFactory().createReqRef();
                req.Paragraph = paragraph;
                appendRequirements(req);
            }

            return(retVal);
        }
        public StandardValuesCollection GetValues(ReqRef req)
        {
            FinderRepository.INSTANCE.ClearCache();

            List<string> retVal = new List<string>();

            if (req.Model is Rule)
            {
                Rule rule = req.Model as Rule;
                foreach (Paragraph paragraph in rule.ApplicableParagraphs)
                {
                    retVal.Add(paragraph.getId());
                }
            }
            else
            {
                foreach (Dictionary dictionary in req.EFSSystem.Dictionaries)
                {
                    foreach (Specification specification in dictionary.Specifications)
                    {
                        foreach (string paragraph in specification.ParagraphList())
                        {
                            retVal.Add(paragraph);
                        }
                    }
                }
            }

            return new StandardValuesCollection(retVal);
        }