Skip to content

Commit

Permalink
f add Comaprable to Rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyzxs committed Dec 10, 2021
1 parent a721a89 commit b4b290a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion TddLikeYouMeanIt/lib/Rule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@

namespace TddLikeYouMeanIt.lib
{
public abstract class Rule
public abstract class Rule : IComparable<Rule>
{
private readonly int _factors;

protected Rule(int factors) => _factors = factors;

public abstract bool Matches(TurnInput turnInput);

public int CompareTo(Rule? other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;
return _factors.CompareTo(other._factors);
}
}

public abstract class MultipleOfRule : Rule
Expand Down

0 comments on commit b4b290a

Please sign in to comment.