Example #1
0
 /// <summary>
 /// Creates an instance of the structure.
 /// </summary>
 /// <param name="flag">The flag that represents current status.</param>
 /// <param name="node">The current node where the progress is at.</param>
 /// <param name="candidates">The collection of <see cref="Node{TFactor, TStep}"/> instances that will possibly be visited in future.</param>
 public AlgorithmState(AlgorithmFlag flag, Node <TFactor, TStep> node, IReadOnlyCollection <Node <TFactor, TStep> > candidates)
 {
     Flag       = flag;
     Node       = node;
     Candidates = candidates ?? Array.Empty <Node <TFactor, TStep> >();
 }
Example #2
0
        public static AlgorithmState <TFactor, TStep> ReportAndReturn <TFactor, TStep>(this IProgress <AlgorithmState <TFactor, TStep> > observer, AlgorithmFlag flag, Node <TFactor, TStep> node, IReadOnlyCollection <Node <TFactor, TStep> > candidates)
        {
            var state = new AlgorithmState <TFactor, TStep>(flag, node, candidates);

            observer.Report(state);
            return(state);
        }
Example #3
0
 /// <summary>
 /// Creates an instance of the structure.
 /// </summary>
 /// <param name="flag">The flag that represents current status.</param>
 /// <param name="node">The current node where the progress is at.</param>
 public AlgorithmState(AlgorithmFlag flag, Node <TFactor, TStep> node)
 {
     Flag       = flag;
     Node       = node;
     Candidates = Array.Empty <Node <TFactor, TStep> >();
 }
Example #4
0
        public static AlgorithmState <TFactor, TStep> ReportAndReturn <TFactor, TStep>(this IProgress <AlgorithmState <TFactor, TStep> > observer, AlgorithmFlag flag, Node <TFactor, TStep> node)
        {
            var state = new AlgorithmState <TFactor, TStep>(flag, node);

            observer.Report(state);
            return(state);
        }