Class StateRegion.Builder

java.lang.Object
io.github.jspinak.brobot.model.state.StateRegion.Builder
Enclosing class:
StateRegion

public static class StateRegion.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setName

      public StateRegion.Builder setName(String name)
      Sets the name for the StateRegion being built.
      Parameters:
      name - the name to assign
      Returns:
      this builder for method chaining
    • setSearchRegion

      public StateRegion.Builder setSearchRegion(Region searchRegion)
      Sets the search region for this StateRegion.
      Parameters:
      searchRegion - the Region to use
      Returns:
      this builder for method chaining
    • setSearchRegion

      public StateRegion.Builder setSearchRegion(int x, int y, int w, int h)
      Sets the search region using coordinates.
      Parameters:
      x - x-coordinate in pixels
      y - y-coordinate in pixels
      w - width in pixels
      h - height in pixels
      Returns:
      this builder for method chaining
    • setOwnerStateName

      public StateRegion.Builder setOwnerStateName(String stateName)
      Sets the name of the State that owns this StateRegion.
      Parameters:
      stateName - the owner state's name
      Returns:
      this builder for method chaining
    • setStaysVisibleAfterClicked

      public StateRegion.Builder setStaysVisibleAfterClicked(int staysVisibleAfterClicked)
      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

      public StateRegion.Builder setMockFindStochasticModifier(int mockFindStochasticModifier)
      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

      public StateRegion.Builder setTimesActedOn(int timesActedOn)
      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

      public StateRegion.Builder setPosition(Position position)
      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 region
      positionInThisRegion - the position in this region to anchor to
      Returns:
      this builder for method chaining
    • addAnchor

      public StateRegion.Builder addAnchor(Positions.Name definedRegionBorder, Position location)
      Adds an anchor with a specific position.
      Parameters:
      definedRegionBorder - the border position of the anchor region
      location - the specific position to anchor to
      Returns:
      this builder for method chaining
    • setAnchors

      public StateRegion.Builder setAnchors(Anchors anchors)
      Sets the complete Anchors collection for this region.
      Parameters:
      anchors - the Anchors object containing all anchors
      Returns:
      this builder for method chaining
    • addSnapshot

      public StateRegion.Builder addSnapshot(ActionRecord matchSnapshot)
      Adds an action record snapshot to the match history.
      Parameters:
      matchSnapshot - the ActionRecord to add
      Returns:
      this builder for method chaining
    • setMockText

      public StateRegion.Builder setMockText(String mockText)
      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

      public StateRegion.Builder setMatchHistory(ActionHistory matchHistory)
      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

      public StateRegion.Builder addCrossStateAnchor(CrossStateAnchor anchor)
      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

      public StateRegion.Builder setCrossStateAnchors(List<CrossStateAnchor> anchors)
      Sets the complete list of cross-state anchors.
      Parameters:
      anchors - list of CrossStateAnchor objects
      Returns:
      this builder for method chaining
    • setDefineStrategy

      public StateRegion.Builder setDefineStrategy(DefineRegionOptions.DefineAs strategy)
      Sets the strategy for defining this region relative to anchors.
      Parameters:
      strategy - the DefineAs strategy to use
      Returns:
      this builder for method chaining
    • build

      public StateRegion build()
      Builds the StateRegion with all configured properties.
      Returns:
      the constructed StateRegion instance