Class SearchRegionResolver
This component implements a sophisticated region selection strategy that respects the precedence of different region sources. It ensures that the most specific and intentional region definitions take priority over more general ones, while always guaranteeing that at least one search region is available for the operation.
Region Selection Priority (highest to lowest):
- Fixed/defined regions on the pattern or image
- Search regions specified in ActionConfig
- Search regions defined on the pattern or image
- Default full-screen region (fallback)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRegions
(ActionConfig actionConfig) Selects search regions when only ActionConfig are available.getRegions
(ActionConfig actionConfig, Pattern pattern) Selects search regions for a Pattern-based find operation.getRegions
(ActionConfig actionConfig, StateImage stateImage) Selects search regions for a StateImage-based find operation.getRegionsForAllImages
(ActionConfig actionConfig, ObjectCollection... objectCollections) Collects search regions from multiple ObjectCollections.
-
Constructor Details
-
SearchRegionResolver
public SearchRegionResolver()
-
-
Method Details
-
getRegions
Selects search regions for a StateImage-based find operation.This method implements the following priority order:
- Search regions from ActionConfig (highest priority)
- Fixed regions from individual Patterns within the StateImage
- Search regions from individual Patterns within the StateImage
- Default full-screen region if no regions are found
- Parameters:
actionConfig
- The action configuration containing optional search regionsstateImage
- The image that may contain patterns with their own search regions- Returns:
- A non-empty list of regions to search within. Always contains at least one region (full screen) if no specific regions are defined.
-
getRegions
Selects search regions for a Pattern-based find operation.This method implements the following priority order:
- Search regions from ActionConfig (highest priority)
- Fixed regions from the Pattern
- Search regions from the Pattern
- Default full-screen region if no regions are found
- Parameters:
actionConfig
- The action configuration containing optional search regionspattern
- The pattern that may contain its own search regions (fixed or standard)- Returns:
- A non-empty list of regions to search within.
-
getRegions
Selects search regions when only ActionConfig are available.This method is used when there are no pattern or image-specific regions to consider. It ensures that at least one region is always returned for the search operation.
- Parameters:
actionConfig
- The action configuration containing optional search regions- Returns:
- The regions specified in ActionConfig, or a default full-screen region if no regions are defined
-
getRegionsForAllImages
public List<Region> getRegionsForAllImages(ActionConfig actionConfig, ObjectCollection... objectCollections) Collects search regions from multiple ObjectCollections.This method aggregates all search regions from the provided collections of images. If ActionConfig contains any defined regions, those take precedence over the regions defined in the individual images.
- Parameters:
actionConfig
- The action configuration that may override image regionsobjectCollections
- Variable number of collections containing StateImages with their own search regions- Returns:
- A list of all applicable search regions. If ActionConfig has defined regions, returns those; otherwise returns the union of all regions from all images in all collections.
-