Package com.solibri.smc.api.filter
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 Summary
Fields Modifier and Type Field Description static ComponentFilter
ACCEPT_ALL
A filter that accepts all components.static ComponentFilter
ACCEPT_NONE
A filter that accepts no component. -
Method Summary
Modifier and Type Method Description boolean
accept(Component component)
When this method returnstrue
, theComponent
is accepted.static ComponentFilter
all(ComponentFilter... filters)
Returns filter that accepts components when they are accepted by all the specified filters.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.static ComponentFilter
any(ComponentFilter... filters)
Returns filter that accepts components when they are accepted by at least one of the specified filters.static <T> ComponentFilter
componentClassIs(Class<T> componentClass)
Returns filter that accepts components when they belong to the specified class.static ComponentFilter
componentTypeIs(ComponentType componentType)
Returns filter that accepts components when they have the specifiedComponentType
.default ComponentFilter
negated()
Returns a new filter that accepts components when they are not accepted by this filter.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.static <T> ComponentFilter
propertyValueEquals(PropertyReference propertyReference, T value)
Returns a filter that accepts components when the specified property has a specified target value.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.
-
Field Details
-
ACCEPT_ALL
A filter that accepts all components.- Since:
- 9.10.2
-
ACCEPT_NONE
A filter that accepts no component.- Since:
- 9.10.2
-
-
Method Details
-
accept
When this method returnstrue
, theComponent
is accepted.- Parameters:
component
- the component- Returns:
- true if component passes the filter, false otherwise
- Since:
- 9.10.2
-
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
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
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
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
- thePropertyReference
referencing the property to checkvalue
- 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
- thePropertyReference
referencing the property to checkpredicate
- 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
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
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
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
Returns filter that accepts components when they have the specifiedComponentType
.- Parameters:
componentType
- theComponentType
of the component- Returns:
- a filter that accepts components when they have the specified
ComponentType
-