Class StateRegion.Builder
java.lang.Object
io.github.jspinak.brobot.model.state.StateRegion.Builder
- Enclosing class:
StateRegion
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAnchor
(Positions.Name definedRegionBorder, Position location) Adds an anchor with a specific position.addAnchor
(Positions.Name definedRegionBorder, Positions.Name positionInThisRegion) Adds an anchor relating a border of a defined region to a position in this region.addCrossStateAnchor
(CrossStateAnchor anchor) Adds a cross-state anchor for positioning relative to elements in other states.addSnapshot
(ActionRecord matchSnapshot) Adds an action record snapshot to the match history.build()
Builds the StateRegion with all configured properties.setAnchors
(Anchors anchors) Sets the complete Anchors collection for this region.setCrossStateAnchors
(List<CrossStateAnchor> anchors) Sets the complete list of cross-state anchors.Sets the strategy for defining this region relative to anchors.setMatchHistory
(ActionHistory matchHistory) Sets the complete match history for this region.setMockFindStochasticModifier
(int mockFindStochasticModifier) Sets the probability that actionable content exists in this region.setMockText
(String mockText) Sets the mock text for this region.Sets the name for the StateRegion being built.setOwnerStateName
(String stateName) Sets the name of the State that owns this StateRegion.setPosition
(Position position) Sets the target position within the region for clicks.setSearchRegion
(int x, int y, int w, int h) Sets the search region using coordinates.setSearchRegion
(Region searchRegion) Sets the search region for this StateRegion.setStaysVisibleAfterClicked
(int staysVisibleAfterClicked) Sets the probability that this region remains visible after being clicked.setTimesActedOn
(int timesActedOn) Sets the initial count of times this region has been acted upon.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setName
Sets the name for the StateRegion being built.- Parameters:
name
- the name to assign- Returns:
- this builder for method chaining
-
setSearchRegion
Sets the search region for this StateRegion.- Parameters:
searchRegion
- the Region to use- Returns:
- this builder for method chaining
-
setSearchRegion
Sets the search region using coordinates.- Parameters:
x
- x-coordinate in pixelsy
- y-coordinate in pixelsw
- width in pixelsh
- height in pixels- Returns:
- this builder for method chaining
-
setOwnerStateName
Sets the name of the State that owns this StateRegion.- Parameters:
stateName
- the owner state's name- Returns:
- this builder for method chaining
-
setStaysVisibleAfterClicked
Sets the probability that this region remains visible after being clicked.- Parameters:
staysVisibleAfterClicked
- probability (0-100) of staying visible- Returns:
- this builder for method chaining
-
setMockFindStochasticModifier
Sets the probability that actionable content exists in this region.- Parameters:
mockFindStochasticModifier
- probability (0-100) of content existence- Returns:
- this builder for method chaining
-
setTimesActedOn
Sets the initial count of times this region has been acted upon.- Parameters:
timesActedOn
- the initial interaction count- Returns:
- this builder for method chaining
-
setPosition
Sets the target position within the region for clicks. Position is relative (0.0-1.0) where 0.5,0.5 is center.- Parameters:
position
- the Position for clicks- Returns:
- this builder for method chaining
-
addAnchor
public StateRegion.Builder addAnchor(Positions.Name definedRegionBorder, Positions.Name positionInThisRegion) Adds an anchor relating a border of a defined region to a position in this region.- Parameters:
definedRegionBorder
- the border position of the anchor regionpositionInThisRegion
- the position in this region to anchor to- Returns:
- this builder for method chaining
-
addAnchor
Adds an anchor with a specific position.- Parameters:
definedRegionBorder
- the border position of the anchor regionlocation
- the specific position to anchor to- Returns:
- this builder for method chaining
-
setAnchors
Sets the complete Anchors collection for this region.- Parameters:
anchors
- the Anchors object containing all anchors- Returns:
- this builder for method chaining
-
addSnapshot
Adds an action record snapshot to the match history.- Parameters:
matchSnapshot
- the ActionRecord to add- Returns:
- this builder for method chaining
-
setMockText
Sets the mock text for this region. Used in testing and mock mode to simulate text content.- Parameters:
mockText
- the text to use in mock scenarios- Returns:
- this builder for method chaining
-
setMatchHistory
Sets the complete match history for this region. Contains historical interaction data for learning and mocking.- Parameters:
matchHistory
- the ActionHistory to use- Returns:
- this builder for method chaining
-
addCrossStateAnchor
Adds a cross-state anchor for positioning relative to elements in other states.- Parameters:
anchor
- the CrossStateAnchor to add- Returns:
- this builder for method chaining
-
setCrossStateAnchors
Sets the complete list of cross-state anchors.- Parameters:
anchors
- list of CrossStateAnchor objects- Returns:
- this builder for method chaining
-
setDefineStrategy
Sets the strategy for defining this region relative to anchors.- Parameters:
strategy
- the DefineAs strategy to use- Returns:
- this builder for method chaining
-
build
Builds the StateRegion with all configured properties.- Returns:
- the constructed StateRegion instance
-