src/GenFx/GeneticAlgorithm.cs
/// <summary>
/// Detects whether there's a cycle in the metric type dependency graph and throws an exception
/// if there is.
/// </summary>
/// <param name="currentNode">The node to search dependencies of.</param>
/// <param name="nodeToSearch">The node to search for a match of.</param>
Detects whether there's a cycle in the metric type dependency graph and throws an exception
if there is.
Detects whether there ' s a cycle in the metric type dependency graph and throws an exception if there is .
private static void DetectMetricTypeDependencyCycle(MetricNode currentNode, MetricNode nodeToSearch)
        {
            foreach (MetricNode dependentNode in currentNode.Dependencies)
            {
                if (dependentNode.MetricType == nodeToSearch.MetricType)
                {
                    throw new InvalidOperationException(
                        StringUtil.GetFormattedString(Resources.ErrorMsg_CycleInMetricDependencyGraph, nodeToSearch.MetricType));
                }
                DetectMetricTypeDependencyCycle(dependentNode, nodeToSearch);
            }
        }
private static void DetectMetricTypeDependencyCycle ( MetricNode currentNode , MetricNode nodeToSearch ) { foreach ( MetricNode dependentNode in currentNode . Dependencies ) { if ( dependentNode . MetricType == nodeToSearch . MetricType ) { throw new InvalidOperationException ( StringUtil . GetFormattedString ( Resources . ErrorMsg_CycleInMetricDependencyGraph , nodeToSearch . MetricType ) ) ; } DetectMetricTypeDependencyCycle ( dependentNode , nodeToSearch ) ; } }
Detects whether there's a cycle in the metric type dependency graph and throws an exception
if there is.
Detects whether there ' s a cycle in the metric type dependency graph and throws an exception if there is .
currentNode
MetricNode
The node to search dependencies of.
The node to search dependencies of .
nodeToSearch
MetricNode
The node to search for a match of.
The node to search for a match of .