Interface Query<ECS_TYPE>

Type Parameters:
ECS_TYPE - The type of the ECS.
All Known Subinterfaces:
ReadWriteArchetypeQuery<ECS_TYPE>
All Known Implementing Classes:
AllLegacyEntityTypesQuery, AllLegacyLivingEntityTypesQuery, AndQuery, AnyQuery, Archetype, ComponentType, ExactArchetypeQuery, NotQuery, OrQuery, ReadWriteQuery

public interface Query<ECS_TYPE>
An interface that represents a query for matching archetypes.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <ECS_TYPE> AndQuery<ECS_TYPE>
    and(Query<ECS_TYPE>... queries)
    Creates a query that matches if all the provided queries match.
    static <ECS_TYPE> AnyQuery<ECS_TYPE>
    any()
    Creates a query that matches any archetype.
    static <ECS_TYPE> NotQuery<ECS_TYPE>
    not(Query<ECS_TYPE> query)
    Creates a query that matches an exact archetype.
    static <ECS_TYPE> OrQuery<ECS_TYPE>
    or(Query<ECS_TYPE>... queries)
    Creates a query that matches if any of the provided queries match.
    boolean
    Controls if a query requires a component and so if used by a system it should be automatically unregistered if a component type is removed.
    boolean
    test(Archetype<ECS_TYPE> archetype)
    Controls if this query should process the provided Archetype.
    void
    Validates the internal state of this query.
    void
    Validates that the provided ComponentRegistry is compatible with this query.
  • Method Details

    • any

      @Nonnull static <ECS_TYPE> AnyQuery<ECS_TYPE> any()
      Creates a query that matches any archetype.
      Type Parameters:
      ECS_TYPE - The type of the ECS.
      Returns:
      the AnyQuery instance.
    • not

      @Nonnull static <ECS_TYPE> NotQuery<ECS_TYPE> not(@Nonnull Query<ECS_TYPE> query)
      Creates a query that matches an exact archetype.
      Type Parameters:
      ECS_TYPE - The type of the ECS.
      Parameters:
      query - The query to negate.
      Returns:
      the NotQuery instance.
    • and

      @Nonnull @SafeVarargs static <ECS_TYPE> AndQuery<ECS_TYPE> and(@Nonnull Query<ECS_TYPE>... queries)
      Creates a query that matches if all the provided queries match.
      Type Parameters:
      ECS_TYPE - The type of the ECS.
      Parameters:
      queries - The queries to match.
      Returns:
      the AndQuery instance.
    • or

      @Nonnull @SafeVarargs static <ECS_TYPE> OrQuery<ECS_TYPE> or(@Nonnull Query<ECS_TYPE>... queries)
      Creates a query that matches if any of the provided queries match.
      Type Parameters:
      ECS_TYPE - The type of the ECS.
      Parameters:
      queries - The queries to match.
      Returns:
      the OrQuery instance.
    • test

      boolean test(Archetype<ECS_TYPE> archetype)
      Controls if this query should process the provided Archetype.
      Returns:
      true if the archetype should be processed by this query.
    • requiresComponentType

      boolean requiresComponentType(ComponentType<ECS_TYPE,?> componentType)
      Controls if a query requires a component and so if used by a system it should be automatically unregistered if a component type is removed.
      Returns:
      true if the componentType is required.
    • validateRegistry

      void validateRegistry(@Nonnull ComponentRegistry<ECS_TYPE> registry)
      Validates that the provided ComponentRegistry is compatible with this query.
      Parameters:
      registry - The component registry to validate against.
    • validate

      void validate()
      Validates the internal state of this query.