Table of Contents

Struct CountryQueryBuilder

Namespace
Core.Queries
Assembly
Core.dll

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

countrySystem CountrySystem
provinceSystem ProvinceSystem
adjacencySystem AdjacencySystem

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

countryId ushort

Returns

CountryQueryBuilder

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

allocator Allocator

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

CountryQueryBuilder

HasProvinces()

Filter to countries that have at least one province. Requires ProvinceSystem.

public CountryQueryBuilder HasProvinces()

Returns

CountryQueryBuilder

WithGraphicalCulture(byte)

Filter to countries with specific graphical culture.

public CountryQueryBuilder WithGraphicalCulture(byte cultureId)

Parameters

cultureId byte

Returns

CountryQueryBuilder

WithMaxProvinces(int)

Filter to countries with at most N provinces. Requires ProvinceSystem.

public CountryQueryBuilder WithMaxProvinces(int maxCount)

Parameters

maxCount int

Returns

CountryQueryBuilder

WithMinProvinces(int)

Filter to countries with at least N provinces. Requires ProvinceSystem.

public CountryQueryBuilder WithMinProvinces(int minCount)

Parameters

minCount int

Returns

CountryQueryBuilder

WithProvinceCount(int, int)

Filter to countries with province count in range. Requires ProvinceSystem.

public CountryQueryBuilder WithProvinceCount(int min, int max)

Parameters

min int
max int

Returns

CountryQueryBuilder