-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use proper modifiers, names and primary constructors
- Loading branch information
Showing
8 changed files
with
37 additions
and
74 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
SocietalConstructionTool/Compiler/Exceptions/UnrecognizedValueException.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
namespace Sct.Runtime | ||
{ | ||
public class QueryHandler : IQueryHandler | ||
public class QueryHandler(IEnumerable<BaseAgent> agents) : IQueryHandler | ||
{ | ||
private readonly IEnumerable<BaseAgent> _agents; | ||
public QueryHandler(IEnumerable<BaseAgent> agents) | ||
{ | ||
_agents = agents; | ||
} | ||
|
||
private IEnumerable<BaseAgent> Filter(IQueryPredicate predicate) => _agents.Where(a => predicate.Test(a)); | ||
private IEnumerable<BaseAgent> Filter(IQueryPredicate predicate) => agents.Where(predicate.Test); | ||
|
||
public int Count(IQueryPredicate predicate) => Filter(predicate).Count(); | ||
|
||
public bool Exists(IQueryPredicate predicate) => Count(predicate) > 0; | ||
public bool Exists(IQueryPredicate predicate) => Filter(predicate).Any(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters