コード例 #1
0
        public IEnumerable <IEAElement> GetDecisionsForTopic()
        {
            IEAElement element = EAMain.Repository.GetElementByGUID(GUID);

            if (!EAMain.IsTopic(element))
            {
                throw new Exception("EAElementImpl is not a topic");
            }

            return(from IEAElement e in element.GetElements() where EAMain.IsDecision(e) select e);
        }
コード例 #2
0
        /// <summary>
        ///     Adds an element and its children to the node
        /// </summary>
        /// <param name="node">Node to be added to</param>
        /// <param name="element"></param>
        /// <returns>A node with element information and its children</returns>
        private TreeNode AddElementToNode(TreeNode node, IEAElement element)
        {
            node.ImageKey = element.GUID;
            node.Text     = element.Name;

            foreach (IEAElement el in element.GetElements())
            {
                if (el.Name.Equals("") || EAMain.IsHistoryDecision(el))
                {
                    continue;
                }
                if (_decision && (!EAMain.IsDecision(el) && !EAMain.IsTopic(el)))
                {
                    continue;
                }
                node.Nodes.Add((AddElementToNode(new TreeNode(), el)));
            }
            return(node);
        }
コード例 #3
0
        public IEnumerable <IEAElement> GetAllElementsOfSubTree()
        {
            var elements      = new List <IEAElement>();
            var packagesStack = new Stack <IEAPackage>();
            var elementsStack = new Stack <IEAElement>();

            packagesStack.Push(this);
            while (packagesStack.Count > 0)
            {
                IEAPackage package = packagesStack.Pop();
                package.Elements.ToList().ForEach(elementsStack.Push);
                package.Packages.ToList().ForEach(packagesStack.Push);
            }
            while (elementsStack.Count > 0)
            {
                IEAElement element = elementsStack.Pop();
                element.GetElements().ForEach(elementsStack.Push);
                elements.Add(element);
            }
            return(elements);
        }