Table of Contents

Struct QueryBuilder

Namespace
KeenEyes
Assembly
KeenEyes.Core.dll

Fluent builder for constructing queries.

public readonly struct QueryBuilder : IQueryBuilder, IEnumerable<Entity>, IEnumerable
Implements
Inherited Members
Extension Methods

Properties

Description

Gets the query description.

public QueryDescription Description { get; }

Property Value

QueryDescription

World

Gets the world this query operates on.

public World World { get; }

Property Value

World

Methods

Count()

Counts the number of entities matching this query.

public int Count()

Returns

int

The number of entities matching the query.

Remarks

This method is optimized to avoid LINQ overhead and is safe to use in hot paths. When no string tag filters are applied, it sums archetype counts directly (O(archetypes)). When string tag filters are present, it must iterate entities (O(entities)).

GetEnumerator()

Gets an enumerator for iterating over matching entities.

public QueryEnumerator GetEnumerator()

Returns

QueryEnumerator

An enumerator over the entities matching this query.

WithTag(string)

Requires the entity to have this string tag.

public QueryBuilder WithTag(string tag)

Parameters

tag string

The string tag that must be present.

Returns

QueryBuilder

This builder for chaining.

Exceptions

ArgumentNullException

Thrown when tag is null.

ArgumentException

Thrown when tag is empty or whitespace.

With<TWith>()

Requires the entity to have this component (filter only, not accessed).

public QueryBuilder With<TWith>() where TWith : struct, IComponent

Returns

QueryBuilder

This builder for chaining.

Type Parameters

TWith

The component type that must be present.

WithoutTag(string)

Excludes entities that have this string tag.

public QueryBuilder WithoutTag(string tag)

Parameters

tag string

The string tag that must NOT be present.

Returns

QueryBuilder

This builder for chaining.

Exceptions

ArgumentNullException

Thrown when tag is null.

ArgumentException

Thrown when tag is empty or whitespace.

Without<TWithout>()

Excludes entities that have this component.

public QueryBuilder Without<TWithout>() where TWithout : struct, IComponent

Returns

QueryBuilder

This builder for chaining.

Type Parameters

TWithout

The component type that must not be present.