Skip to content

Commit

Permalink
Fix type of exists and count
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMagzuz committed Apr 25, 2024
1 parent abac73b commit 136f5b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions SocietalConstructionTool/Runtime/IQueryHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Sct.Runtime
{
public interface IQueryHandler
{
public int Count(IRuntimeContext ctx, IQueryPredicate predicate);
public bool Exists(IRuntimeContext ctx, IQueryPredicate predicate);
public long Count(IRuntimeContext ctx, IQueryPredicate predicate);
public long Exists(IRuntimeContext ctx, IQueryPredicate predicate);
}
}
4 changes: 2 additions & 2 deletions SocietalConstructionTool/Runtime/QueryHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class QueryHandler(IEnumerable<BaseAgent> agents) : IQueryHandler
{
private IEnumerable<BaseAgent> Filter(IQueryPredicate predicate) => agents.Where(predicate.Test);

public int Count(IRuntimeContext ctx, IQueryPredicate predicate) => Filter(predicate).Count();
public bool Exists(IRuntimeContext ctx, IQueryPredicate predicate) => Filter(predicate).Any();
public long Count(IRuntimeContext ctx, IQueryPredicate predicate) => Filter(predicate).Count();
public long Exists(IRuntimeContext ctx, IQueryPredicate predicate) => Filter(predicate).Any() ? 1 : 0;
}
}

0 comments on commit 136f5b9

Please sign in to comment.