Table of Contents

Struct QueryDescriptor

Namespace
KeenEyes
Assembly
KeenEyes.Core.dll

Immutable descriptor for a query, used as a cache key. Two queries with the same With and Without types produce the same descriptor.

public readonly struct QueryDescriptor : IEquatable<QueryDescriptor>
Implements
Inherited Members

Remarks

QueryDescriptor uses value equality based on the sorted component types in both the With and Without sets. This ensures consistent cache lookup regardless of the order components were specified.

Use FromDescription(QueryDescription) to create a descriptor from an existing QueryDescription.

Constructors

QueryDescriptor(IEnumerable<Type>, IEnumerable<Type>)

Creates a QueryDescriptor with the specified component requirements.

public QueryDescriptor(IEnumerable<Type> with, IEnumerable<Type> without)

Parameters

with IEnumerable<Type>

Component types that must be present.

without IEnumerable<Type>

Component types that must NOT be present.

Properties

With

Gets the component types that must be present.

public ImmutableArray<Type> With { get; }

Property Value

ImmutableArray<Type>

Without

Gets the component types that must NOT be present.

public ImmutableArray<Type> Without { get; }

Property Value

ImmutableArray<Type>

Methods

Equals(QueryDescriptor)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(QueryDescriptor other)

Parameters

other QueryDescriptor

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FromDescription(QueryDescription)

Creates a QueryDescriptor from a QueryDescription.

public static QueryDescriptor FromDescription(QueryDescription description)

Parameters

description QueryDescription

The query description.

Returns

QueryDescriptor

An immutable descriptor for cache lookup.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Matches(Archetype)

Checks if an archetype matches this query descriptor.

public bool Matches(Archetype archetype)

Parameters

archetype Archetype

The archetype to check.

Returns

bool

True if the archetype matches.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(QueryDescriptor, QueryDescriptor)

Equality operator.

public static bool operator ==(QueryDescriptor left, QueryDescriptor right)

Parameters

left QueryDescriptor
right QueryDescriptor

Returns

bool

operator !=(QueryDescriptor, QueryDescriptor)

Inequality operator.

public static bool operator !=(QueryDescriptor left, QueryDescriptor right)

Parameters

left QueryDescriptor
right QueryDescriptor

Returns

bool