Interface ComponentFilter

All Known Subinterfaces:
AABBIntersectionFilter, LineIntersectionFilter, RayIntersectionFilter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface ComponentFilter
ComponentFilter is used to filter components. This is an interface that all such filters should implement.
Since:
9.10.2
  • Field Details

    • ACCEPT_ALL

      static final ComponentFilter ACCEPT_ALL
      A filter that accepts all components.
      Since:
      9.10.2
    • ACCEPT_NONE

      static final ComponentFilter ACCEPT_NONE
      A filter that accepts no component.
      Since:
      9.10.2
  • Method Details

    • accept

      boolean accept​(Component component)
      When this method returns true, the Component is accepted.
      Parameters:
      component - the component
      Returns:
      true if component passes the filter, false otherwise
      Since:
      9.10.2
    • negated

      default ComponentFilter negated()
      Returns a new filter that accepts components when they are not accepted by this filter.
      Returns:
      a new filter that accepts components when they are not accepted by this filter
      Since:
      9.10.2
    • and

      default ComponentFilter and​(ComponentFilter other)
      Returns a new filter that accepts components that are accepted by both this filter and other filter at the same time.
      Parameters:
      other - the other filter to combine with this one
      Returns:
      a new filter that accepts components accepted by both this filter and other
    • or

      default ComponentFilter or​(ComponentFilter other)
      Returns a new filter that accepts components that are accepted by either this filter or the other filter or both.
      Parameters:
      other - the other filter to combine with this one
      Returns:
      a new filter that accepts components accepted by this filter or other or both
    • propertyValueEquals

      static <T> ComponentFilter propertyValueEquals​(PropertyReference propertyReference, T value)
      Returns a filter that accepts components when the specified property has a specified target value. If the type parameter T does not match the type of the property, no value is going to be retrieved.
      Type Parameters:
      T - the expected type of the specified target value
      Parameters:
      propertyReference - the PropertyReference referencing the property to check
      value - the specified target value
      Returns:
      a filter that accepts components when the specified property has a specified target value
    • propertyValueMatches

      static <T> ComponentFilter propertyValueMatches​(PropertyReference propertyReference, Predicate<Optional<T>> predicate)
      Returns a filter that accepts components when the specified component's property value matches the given predicate.
      Type Parameters:
      T - the expected type of the specified target value
      Parameters:
      propertyReference - the PropertyReference referencing the property to check
      predicate - the given predicate for the optional target value of the property
      Returns:
      a filter that accepts components when the specified property matches the given predicate
    • all

      static ComponentFilter all​(ComponentFilter... filters)
      Returns filter that accepts components when they are accepted by all the specified filters.
      Parameters:
      filters - the specified filters
      Returns:
      a filter that accepts components accepted by all the specified filters
    • any

      static ComponentFilter any​(ComponentFilter... filters)
      Returns filter that accepts components when they are accepted by at least one of the specified filters.
      Parameters:
      filters - the specified filters
      Returns:
      a filter that accepts components accepted by any of the specified filters
    • componentClassIs

      static <T> ComponentFilter componentClassIs​(Class<T> componentClass)
      Returns filter that accepts components when they belong to the specified class.
      Type Parameters:
      T - the type of the component
      Parameters:
      componentClass - the class of the accepted components
      Returns:
      a filter that accepts components when they belong to the specified class
    • componentTypeIs

      static ComponentFilter componentTypeIs​(ComponentType componentType)
      Returns filter that accepts components when they have the specified ComponentType.
      Parameters:
      componentType - the ComponentType of the component
      Returns:
      a filter that accepts components when they have the specified ComponentType