protected AlgorithmBase(TGraph visitedGraph) { if (visitedGraph == null) { throw new ArgumentNullException("visitedGraph"); } this.visitedGraph = visitedGraph; this.services = new AlgorithmServices(this); }
/// <summary> /// Initializes a new instance of the <see cref="AlgorithmBase{TGraph}"/> class. /// </summary> /// <param name="visitedGraph">Graph to visit.</param> protected AlgorithmBase([NotNull] TGraph visitedGraph) { if (visitedGraph == null) { throw new ArgumentNullException(nameof(visitedGraph)); } VisitedGraph = visitedGraph; _algorithmServices = new AlgorithmServices(this); }
/// <summary> /// Creates a new algorithm with an (optional) host. /// </summary> /// <param name="host">if null, host is set to the this reference</param> /// <param name="visitedGraph"></param> protected AlgorithmBase([CanBeNull] IAlgorithmComponent host, TGraph visitedGraph) { Contract.Requires(visitedGraph != null); if (host == null) { host = this; } this.visitedGraph = visitedGraph; this.services = new AlgorithmServices(host); }
/// <summary> /// Creates a new algorithm with an (optional) host. /// </summary> /// <param name="host">if null, host is set to the this reference</param> /// <param name="visitedGraph"></param> protected AlgorithmBase(IAlgorithmComponent host, TGraph visitedGraph) { if (host == null) { host = this; } if (visitedGraph == null) { throw new ArgumentNullException("visitedGraph"); } this.visitedGraph = visitedGraph; this.services = new AlgorithmServices(host); }
/// <summary> /// Initializes a new instance of the <see cref="AlgorithmBase{TGraph}"/> class (with optional host). /// </summary> /// <param name="host">Host to use if set, otherwise use this reference.</param> /// <param name="visitedGraph">Graph to visit.</param> protected AlgorithmBase([CanBeNull] IAlgorithmComponent host, [NotNull] TGraph visitedGraph) { if (visitedGraph == null) { throw new ArgumentNullException(nameof(visitedGraph)); } if (host is null) { host = this; } VisitedGraph = visitedGraph; _algorithmServices = new AlgorithmServices(host); }
protected AlgorithmBase(TGraph visitedGraph) { Contract.Requires(visitedGraph != null); this.visitedGraph = visitedGraph; this.services = new AlgorithmServices(this); }