Struct CountryQueryBuilder
Fluent query builder for country filtering. Lazy evaluation - filters are applied when terminal operation is called.
Usage: using var results = new CountryQueryBuilder(countrySystem, provinceSystem) .WithMinProvinces(5) .BorderingCountry(targetCountryId) .Execute(Allocator.Temp);
Performance: O(C) where C = countries, single pass with combined filters.
public struct CountryQueryBuilder
Constructors
CountryQueryBuilder(CountrySystem, ProvinceSystem, AdjacencySystem)
public CountryQueryBuilder(CountrySystem countrySystem, ProvinceSystem provinceSystem = null, AdjacencySystem adjacencySystem = null)
Parameters
countrySystemCountrySystemprovinceSystemProvinceSystemadjacencySystemAdjacencySystem
Methods
Any()
Check if any country matches the filters.
public bool Any()
Returns
- bool
BorderingCountry(ushort)
Filter to countries that border a specific country. Requires ProvinceSystem and AdjacencySystem.
public CountryQueryBuilder BorderingCountry(ushort countryId)
Parameters
countryIdushort
Returns
Count()
Count matching countries without allocating result list.
public int Count()
Returns
- int
Dispose()
public void Dispose()
Execute(Allocator)
Execute query and return matching country IDs. Caller must dispose the returned NativeList.
public NativeList<ushort> Execute(Allocator allocator)
Parameters
allocatorAllocator
Returns
- NativeList<ushort>
FirstOrDefault()
Get first matching country, or 0 if none.
public ushort FirstOrDefault()
Returns
- ushort
HasNoProvinces()
Filter to countries with no provinces. Requires ProvinceSystem.
public CountryQueryBuilder HasNoProvinces()
Returns
HasProvinces()
Filter to countries that have at least one province. Requires ProvinceSystem.
public CountryQueryBuilder HasProvinces()
Returns
WithGraphicalCulture(byte)
Filter to countries with specific graphical culture.
public CountryQueryBuilder WithGraphicalCulture(byte cultureId)
Parameters
cultureIdbyte
Returns
WithMaxProvinces(int)
Filter to countries with at most N provinces. Requires ProvinceSystem.
public CountryQueryBuilder WithMaxProvinces(int maxCount)
Parameters
maxCountint
Returns
WithMinProvinces(int)
Filter to countries with at least N provinces. Requires ProvinceSystem.
public CountryQueryBuilder WithMinProvinces(int minCount)
Parameters
minCountint
Returns
WithProvinceCount(int, int)
Filter to countries with province count in range. Requires ProvinceSystem.
public CountryQueryBuilder WithProvinceCount(int min, int max)
Parameters
minintmaxint