Skip to content

Commit 58b9714

Browse files
committed
simplified List Parameters
1 parent 6c2f87a commit 58b9714

File tree

107 files changed

+2352
-2586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2352
-2586
lines changed

src/QuikGraph/Algorithms/Exploration/CloneableVertexGraphExplorerAlgorithm.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,14 @@ public void AddTransitionFactory([NotNull] ITransitionFactory<TVertex, TEdge> tr
189189
_transitionFactories.Add(transitionFactory);
190190
}
191191

192-
/// <summary>
193-
/// Adds new <see cref="ITransitionFactory{TVertex,TEdge}"/>s to this algorithm.
194-
/// </summary>
195-
/// <param name="transitionFactories">Transition factories to add.</param>
196-
/// <exception cref="T:System.ArgumentNullException"><paramref name="transitionFactories"/> is <see langword="null"/>.</exception>
192+
/// <summary>Adds new <see cref="ITransitionFactory{TVertex,TEdge}"/>s to this algorithm. </summary>
193+
public void AddTransitionFactories(
194+
[NotNull, ItemNotNull] params ITransitionFactory<TVertex, TEdge>[] transitionFactories)
195+
{
196+
AddTransitionFactories(transitionFactories.AsEnumerable());
197+
}
198+
199+
/// <summary>Adds new <see cref="ITransitionFactory{TVertex,TEdge}"/>s to this algorithm. </summary>
197200
public void AddTransitionFactories(
198201
[NotNull, ItemNotNull] IEnumerable<ITransitionFactory<TVertex, TEdge>> transitionFactories)
199202
{

src/QuikGraph/Algorithms/TarjanOfflineLeastCommonAncestorAlgorithm.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,13 @@ public bool TryGetVertexPairs(out IEnumerable<SEquatableEdge<TVertex>> pairs)
124124
return pairs != null;
125125
}
126126

127-
/// <summary>
128-
/// Sets vertices pairs.
129-
/// </summary>
127+
/// <summary> Sets vertices pairs. </summary>
128+
/// <param name="pairs">Vertices pairs.</param>
129+
/// <exception cref="T:System.ArgumentNullException"><paramref name="pairs"/> is <see langword="null"/>.</exception>
130+
/// <exception cref="T:System.ArgumentException"><paramref name="pairs"/> is empty or any vertex from pairs is not part of <see cref="AlgorithmBase{TGraph}.VisitedGraph"/>.</exception>
131+
public void SetVertexPairs([NotNull] params SEquatableEdge<TVertex>[] pairs) => SetVertexPairs(pairs.AsEnumerable());
132+
133+
/// <summary> Sets vertices pairs. </summary>
130134
/// <param name="pairs">Vertices pairs.</param>
131135
/// <exception cref="T:System.ArgumentNullException"><paramref name="pairs"/> is <see langword="null"/>.</exception>
132136
/// <exception cref="T:System.ArgumentException"><paramref name="pairs"/> is empty or any vertex from pairs is not part of <see cref="AlgorithmBase{TGraph}.VisitedGraph"/>.</exception>

src/QuikGraph/Extensions/EdgeExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ internal static bool SortedVertexEqualityInternal<TVertex>(
414414
[Pure]
415415
[NotNull]
416416
public static IEnumerable<SReversedEdge<TVertex, TEdge>> ReverseEdges<TVertex, TEdge>(
417-
[NotNull, ItemNotNull] IEnumerable<TEdge> edges)
417+
[NotNull, ItemNotNull] this IEnumerable<TEdge> edges)
418418
where TEdge : IEdge<TVertex>
419419
{
420420
if (edges is null)

src/QuikGraph/Interfaces/Graphs/IMutableEdgeListGraph.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using JetBrains.Annotations;
45

56
namespace QuikGraph
67
{
8+
/// <summary> Extension Methods for <see cref="IMutableEdgeListGraph{TVertex, TEdge}"/> </summary>
9+
public static class MutableEdgeListGraph
10+
{
11+
/// <summary> Adds the <paramref name="edges"/> to the <paramref name="graph"/>. </summary>
12+
public static int AddEdgeRange<TVertex, TEdge>(this IMutableEdgeListGraph<TVertex, TEdge> graph
13+
, [NotNull, ItemNotNull] params TEdge[] edges) where TEdge : IEdge<TVertex>
14+
=> graph.AddEdgeRange(edges.AsEnumerable());
15+
16+
}
17+
718
/// <summary>
819
/// A mutable edge list graph with vertices of type <typeparamref name="TVertex"/>
920
/// and edges of type <typeparamref name="TEdge"/>.
@@ -27,9 +38,7 @@ public interface IMutableEdgeListGraph<TVertex, TEdge> : IMutableGraph<TVertex,
2738
/// </summary>
2839
event EdgeAction<TVertex, TEdge> EdgeAdded;
2940

30-
/// <summary>
31-
/// Adds a set of edges to this graph.
32-
/// </summary>
41+
/// <summary> Adds the <paramref name="edges"/> to this graph. </summary>
3342
/// <param name="edges">Edges to add.</param>
3443
/// <returns>The number of edges successfully added to this graph.</returns>
3544
/// <exception cref="T:System.ArgumentNullException">

src/QuikGraph/Interfaces/Graphs/IMutableVertexSet.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
4+
using System.Linq;
35
using JetBrains.Annotations;
46

57
namespace QuikGraph
68
{
7-
/// <summary>
8-
/// Represents a mutable set of vertices.
9-
/// </summary>
10-
/// <typeparam name="TVertex">Vertex type.</typeparam>
9+
/// <summary> Extension Methods for <see cref="IMutableVertexSet{TVertex}"/> </summary>
10+
public static class MutableVertexSet
11+
{
12+
/// <summary>
13+
///
14+
/// </summary>
15+
/// <returns></returns>
16+
public static int AddVertexRange<TVertex>(this IMutableVertexSet<TVertex> set
17+
, [NotNull, ItemNotNull] params TVertex[] vertices) => set.AddVertexRange(vertices.AsEnumerable());
18+
19+
}
20+
21+
/// <summary> Represents a mutable set of vertices.</summary>
1122
public interface IMutableVertexSet<TVertex> : IVertexSet<TVertex>
1223
{
1324
/// <summary>

src/QuikGraph/Structures/Graphs/AdjacencyGraph.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ public virtual bool AddEdge(TEdge edge)
432432
return AddEdgeInternal(edge);
433433
}
434434

435+
/// <inheritdoc />
436+
public int AddEdgeRange(params TEdge[] edges) => AddEdgeRange(edges.AsEnumerable());
437+
435438
/// <inheritdoc />
436439
public int AddEdgeRange(IEnumerable<TEdge> edges)
437440
{

src/QuikGraph/Structures/Graphs/BidirectionalGraph.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.Diagnostics;
45
using System.Linq;
@@ -517,6 +518,9 @@ public virtual bool AddEdge(TEdge edge)
517518
return AddEdgeInternal(edge);
518519
}
519520

521+
/// <inheritdoc />
522+
public int AddEdgeRange(params TEdge[] edges) => AddEdgeRange(edges.AsEnumerable());
523+
520524
/// <inheritdoc />
521525
public int AddEdgeRange(IEnumerable<TEdge> edges)
522526
{

src/QuikGraph/Structures/Graphs/BidirectionalMatrixGraph.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ public bool AddEdge(TEdge edge)
492492
throw new ParallelEdgeNotAllowedException();
493493
}
494494

495+
/// <inheritdoc />
496+
public int AddEdgeRange(params TEdge[] edges) => AddEdgeRange(edges.AsEnumerable());
497+
495498
/// <inheritdoc />
496499
public int AddEdgeRange(IEnumerable<TEdge> edges)
497500
{

src/QuikGraph/Structures/Graphs/ClusteredAdjacencyGraph.cs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,12 @@ public virtual bool AddVertex([NotNull] TVertex vertex)
226226
return Wrapped.AddVertex(vertex);
227227
}
228228

229-
/// <summary>
230-
/// Adds given vertices to this graph.
231-
/// </summary>
232-
/// <param name="vertices">Vertices to add.</param>
229+
/// <summary> Adds the <paramref name="vertices"/> to this graph. </summary>
230+
/// <returns>The number of vertex added.</returns>
231+
public virtual int AddVertexRange([NotNull, ItemNotNull] params TVertex[] vertices) => AddVertexRange(vertices.AsEnumerable());
232+
233+
/// <summary> Adds the <paramref name="vertices"/> to this graph. </summary>
233234
/// <returns>The number of vertex added.</returns>
234-
/// <exception cref="T:System.ArgumentNullException">
235-
/// <paramref name="vertices"/> is <see langword="null"/> or at least one of them is <see langword="null"/>.
236-
/// </exception>
237235
public virtual int AddVertexRange([NotNull, ItemNotNull] IEnumerable<TVertex> vertices)
238236
{
239237
if (vertices is null)
@@ -332,6 +330,17 @@ public virtual bool AddVerticesAndEdge([NotNull] TEdge edge)
332330
return AddEdge(edge);
333331
}
334332

333+
/// <summary>
334+
/// Adds a set of edges (and it's vertices if necessary).
335+
/// </summary>
336+
/// <param name="edges">Edges to add.</param>
337+
/// <returns>The number of edges added.</returns>
338+
/// <exception cref="T:System.ArgumentNullException">
339+
/// <paramref name="edges"/> is <see langword="null"/> or at least one of them is <see langword="null"/>.
340+
/// </exception>
341+
public int AddVerticesAndEdgeRange([NotNull, ItemNotNull] params TEdge[] edges)
342+
=> AddVerticesAndEdgeRange(edges.AsEnumerable());
343+
335344
/// <summary>
336345
/// Adds a set of edges (and it's vertices if necessary).
337346
/// </summary>
@@ -369,9 +378,15 @@ public virtual bool AddEdge([NotNull] TEdge edge)
369378
return Wrapped.AddEdge(edge);
370379
}
371380

372-
/// <summary>
373-
/// Adds a set of edges to this graph.
374-
/// </summary>
381+
/// <summary> Adds a set of edges to this graph. </summary>
382+
/// <param name="edges">Edges to add.</param>
383+
/// <returns>The number of edges successfully added to this graph.</returns>
384+
/// <exception cref="T:System.ArgumentNullException">
385+
/// <paramref name="edges"/> is <see langword="null"/> or at least one of them is <see langword="null"/>.
386+
/// </exception>
387+
public int AddEdgeRange([NotNull, ItemNotNull] params TEdge[] edges) => AddEdgeRange(edges.AsEnumerable());
388+
389+
/// <summary> Adds a set of edges to this graph. </summary>
375390
/// <param name="edges">Edges to add.</param>
376391
/// <returns>The number of edges successfully added to this graph.</returns>
377392
/// <exception cref="T:System.ArgumentNullException">

src/QuikGraph/Structures/Graphs/EdgeListGraph.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.Diagnostics;
45
using System.Linq;
@@ -136,14 +137,18 @@ private bool ContainsEdge(TVertex source, TVertex target)
136137
/// <param name="edge">The edge to add.</param>
137138
/// <returns>True if the edge was added, false otherwise.</returns>
138139
/// <exception cref="T:System.ArgumentNullException"><paramref name="edge"/> is <see langword="null"/>.</exception>
139-
public bool AddVerticesAndEdge([NotNull] TEdge edge)
140-
{
141-
return AddEdge(edge);
142-
}
140+
public bool AddVerticesAndEdge([NotNull] TEdge edge) => AddEdge(edge);
143141

144-
/// <summary>
145-
/// Adds a set of edges (and it's vertices if necessary).
146-
/// </summary>
142+
/// <summary> Adds a set of edges (and it's vertices if necessary). </summary>
143+
/// <param name="edges">Edges to add.</param>
144+
/// <returns>The number of edges added.</returns>
145+
/// <exception cref="T:System.ArgumentNullException">
146+
/// <paramref name="edges"/> is <see langword="null"/> or at least one of them is <see langword="null"/>.
147+
/// </exception>
148+
public int AddVerticesAndEdgeRange([NotNull, ItemNotNull] params TEdge[] edges)
149+
=> AddVerticesAndEdgeRange(edges.AsEnumerable());
150+
151+
/// <summary> Adds a set of edges (and it's vertices if necessary). </summary>
147152
/// <param name="edges">Edges to add.</param>
148153
/// <returns>The number of edges added.</returns>
149154
/// <exception cref="T:System.ArgumentNullException">
@@ -180,6 +185,9 @@ public bool AddEdge(TEdge edge)
180185
return true;
181186
}
182187

188+
/// <inheritdoc />
189+
public int AddEdgeRange(params TEdge[] edges) => AddEdgeRange(edges.AsEnumerable());
190+
183191
/// <inheritdoc />
184192
public int AddEdgeRange(IEnumerable<TEdge> edges)
185193
{

0 commit comments

Comments
 (0)