Esempio n. 1
0
            private void VisitNode(DependencyNode node)
            {
                var firstVisit = _visitHistory.OnVisitingNode(node);

                if(firstVisit)
                {
                    foreach(var dependencyNode in _graph.GetDependencyNodes(node))
                    {
                        VisitNode(dependencyNode);

                        _visitHistory.OnVisitedDependencyNode();
                    }

                    _sortedNodes.Add(node);
                }
            }
Esempio n. 2
0
 private IEnumerable<DependencyNode> GetDependencyNodes(DependencyNode node)
 {
     return node.Dependencies.Select(dependency => _nodes[dependency]);
 }
Esempio n. 3
0
            internal bool OnVisitingNode(DependencyNode node)
            {
                if(_visitedNodesFromRoot.Contains(node))
                {
                    ThrowCalculationCycleException(node.Calculation.Source);
                }

                var firstVisit = !_visitedNodes.Contains(node);

                if(firstVisit)
                {
                    _visitedNodes.Add(node);

                    _visitedNodesFromRoot.Add(node);

                    _context.Push(node);
                }

                return firstVisit;
            }