private void ResolveFromParent(BcsExpressionNode parentNode)
 {
     foreach (var childNode in parentNode.EnumerateChildNodes())
     {
         childNode.ParentNode = parentNode;
     }
 }
示例#2
0
        private void AddToTree(BcsExpressionNode node, MenuItem item)
        {
            //ISSUE: make dedicated function for errors
            foreach (var error in node.Errors)
            {
                item.NodeErrors.Add(error.Message);
            }

            var parentItem = NodeCache[node.ParentNode.UniqueId];

            parentItem.Items.Add(item);
            NodeCache.Add(node.UniqueId, item);
        }
        public void Visit(BcsExpressionNode node)
        {
            if (node is BcsAtomicAgentNode)
            {
                VisitAgent(node as BcsAtomicAgentNode);
            }
            else if (node is BcsAgentStateNode)
            {
                VisitAgentState(node as BcsAgentStateNode);
            }
            else if (node is BcsComponentNode)
            {
                VisitComponent(node as BcsComponentNode);
            }
            else if (node is BcsComplexNode)
            {
                VisitComplex(node as BcsComplexNode);
            }
            else if (node is BcsReactantNode)
            {
                VisitReactant(node as BcsReactantNode);
            }
            else if (node is BcsReactionNode)
            {
                VisitReaction(node as BcsReactionNode);
            }
            else if(node is BcsLocationNode)
            {
                VisitLocation(node as BcsLocationNode);
            }
            else
            {
                VisitDefault(node);
            }

            var children = node.EnumerateChildNodes().ToList();

            foreach (var childNode in children)
            {
                Visit(childNode);
            }
        }
示例#4
0
        protected override void VisitDefault(BcsExpressionNode node)
        {
            var item = new MenuItem() { Title = $"Unknown" };

            AddToTree(node, item);
        }
 protected override void VisitDefault(BcsExpressionNode node)
 {
     ResolveFromParent(node);
 }
 protected abstract void VisitDefault(BcsExpressionNode node);