public static Compare <T> FromComparer <T>(System.Collections.Generic.Comparer <T> comparer) { return((T a, T b) => { int result = comparer.Compare(a, b); if (result == 0) { return Comparison.Equal; } else if (result < 0) { return Comparison.Less; } else if (result > 0) { return Comparison.Greater; } else { throw new System.NotImplementedException(); } }); }
public int Compare(Node <S, A> x, Node <S, A> y) { return(comparer.Compare(evalFn.applyAsDouble(x), evalFn.applyAsDouble(y))); }
/// <summary>Converts a System.Collection.Generic.Comparer into a Towel.Compare delegate.</summary> /// <typeparam name="T">The generic type that the comparing methods operate on.</typeparam> /// <param name="comparer">The system.Collections.Generic.Comparer to convert into a Towel.Compare delegate.</param> /// <returns>The converted Towel.Compare delegate.</returns> public static Compare <T> ToCompare <T>(System.Collections.Generic.Comparer <T> comparer) => (a, b) => Wrap(comparer.Compare(a, b));
public int Compare(Pair <VAL, int> x, Pair <VAL, int> y) { return(comparer.Compare(x.getSecond(), y.getSecond())); }
public int Compare(Node <S, A> x, Node <S, A> y) { return(comparer.Compare(x.getPathCost(), y.getPathCost())); }