Skip to content

Commit

Permalink
Add Documentation on AccumulatedTopologicalCompare
Browse files Browse the repository at this point in the history
+symver: feature
  • Loading branch information
Pretasoc committed Mar 5, 2018
1 parent 0df1f9f commit 2992d95
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;


namespace phirSOFT.TopologicalComparison
{
/// <inheritdoc cref="ITopologicalComparer{T}"/>
/// <summary>
/// A topological comparer that wraps multiple <see cref="ITopologicalComparer{T}"/> into one.
/// </summary>
/// <typeparam name="T">The type to compare</typeparam>
/// <remarks>
/// The comparers are applied in ascending index order.
/// </remarks>
public class AccumulatedTopologicalComparer<T> : Collection<ITopologicalComparer<T>>, ITopologicalComparer<T>
{
/// <inheritdoc cref="IComparer{T}.Compare"/>
public int Compare(T x, T y)
{
return this.First(item => item.CanCompare(x, y)).Compare(x, y);
}

/// <inheritdoc cref="ITopologicalComparer{T}.CanCompare"/>
public bool CanCompare(T x, T y)
{
return this.Any(item => item.CanCompare(x, y));
Expand Down

0 comments on commit 2992d95

Please sign in to comment.