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
withIEnumerable<Type>Component types that must be present.
withoutIEnumerable<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
Without
Gets the component types that must NOT be present.
public ImmutableArray<Type> Without { get; }
Property Value
Methods
Equals(QueryDescriptor)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(QueryDescriptor other)
Parameters
otherQueryDescriptorAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
descriptionQueryDescriptionThe 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
archetypeArchetypeThe 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
leftQueryDescriptorrightQueryDescriptor
Returns
operator !=(QueryDescriptor, QueryDescriptor)
Inequality operator.
public static bool operator !=(QueryDescriptor left, QueryDescriptor right)
Parameters
leftQueryDescriptorrightQueryDescriptor