Skip to content

Commit ec25795

Browse files
committed
ResolveByCallBack callback has object type as argument
1 parent ba42a8e commit ec25795

4 files changed

Lines changed: 23 additions & 12 deletions

File tree

SharpDiffLib/algorithms/resolveConflicts/common/callBack/ResolveByCallBack.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@ namespace SharpDiffLib.algorithms.resolveConflicts.common.callBack
66
{
77
internal class ResolveByCallBack<TType> : IResolveConflictsAlgorithm<TType>
88
{
9-
private readonly Action<IConflictResolver> aCallBack;
9+
private readonly Action<Type, IConflictResolver> aCallBack;
1010

11-
public ResolveByCallBack(Action<IConflictResolver> callBack)
11+
public ResolveByCallBack(Action<Type, IConflictResolver> callBack)
1212
{
1313
this.aCallBack = callBack;
1414
}
1515

16-
#region Implementation of IResolveConflictsAlgorithm
16+
#region Implementation of IResolveConflictsAlgorithm<TType>
1717

1818
public void ResolveConflicts(IConflictResolver<TType> resolver)
1919
{
20-
this.aCallBack(resolver);
20+
this.aCallBack(typeof(TType), resolver);
2121
}
2222

23+
#endregion
24+
25+
#region Implementation of IResolveConflictsAlgorithm
26+
2327
public void ResolveConflicts(IConflictResolver resolver)
2428
{
25-
this.aCallBack(resolver);
29+
this.ResolveConflicts((IConflictResolver<TType>) resolver);
2630
}
2731

2832
#endregion

SharpDiffLib/algorithms/resolveConflicts/common/callBack/ResolveByCallBackRules.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ namespace SharpDiffLib.algorithms.resolveConflicts.common.callBack
77
{
88
public class ResolveByCallBackRules<TDefinedFor> : BaseRules<TDefinedFor>, IResolveConflictsAlgorithmRules<TDefinedFor>
99
{
10-
private Action<IConflictResolver> aCallBack;
10+
private Action<Type, IConflictResolver> aCallBack;
1111

1212
public ResolveByCallBackRules()
1313
{
1414
this.aCallBack = null;
1515
}
1616

17-
public ResolveByCallBackRules<TDefinedFor> CallBack(Action<IConflictResolver> callBack)
17+
public ResolveByCallBackRules<TDefinedFor> CallBack(Action<Type, IConflictResolver> callBack)
1818
{
1919
this.aCallBack = callBack;
2020

SharpDiffLib/algorithms/resolveConflicts/common/dontResolve/DontResolve.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ namespace SharpDiffLib.algorithms.resolveConflicts.common.dontResolve
55
{
66
internal class DontResolve<TType> : IResolveConflictsAlgorithm<TType>
77
{
8-
#region Implementation of IResolveConflictsAlgorithm
8+
#region Implementation of IResolveConflictsAlgorithm<TType>
99

1010
public void ResolveConflicts(IConflictResolver<TType> resolver)
1111
{
1212
throw new NotPossibleToResolveException();
1313
}
1414

15+
#endregion
16+
17+
#region Implementation of IResolveConflictsAlgorithm
18+
1519
public void ResolveConflicts(IConflictResolver resolver)
1620
{
17-
throw new NotPossibleToResolveException();
21+
this.ResolveConflicts((IConflictResolver<TType>)resolver);
1822
}
1923

2024
#endregion

SharpDiffLib/algorithms/resolveConflicts/common/resolveAllSame/ResolveAllSame.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,21 @@ public ResolveAllSame(ResolveAction action)
1313
this.aAction = action;
1414
}
1515

16-
#region Implementation of IResolveConflictsAlgorithm
16+
#region Implementation of IResolveConflictsAlgorithm<TType>
1717

1818
public void ResolveConflicts(IConflictResolver<TType> resolver)
1919
{
2020
foreach (var item in resolver.ToList())
2121
resolver.ResolveConflict(item, this.aAction);
2222
}
2323

24+
#endregion
25+
26+
#region Implementation of IResolveConflictsAlgorithm
27+
2428
public void ResolveConflicts(IConflictResolver resolver)
2529
{
26-
foreach (var item in resolver.ToList())
27-
resolver.ResolveConflict(item, this.aAction);
30+
this.ResolveConflicts((IConflictResolver<TType>)resolver);
2831
}
2932

3033
#endregion

0 commit comments

Comments
 (0)