Class Match

All Implemented Interfaces:
Comparable<Match>

public class Match
extends Region
implements Comparable<Match>
The region on the screen or rectangle in the image, where the given image or text was found.

-

Is itself a Region and holds:

  • Constructor Details

    • Match

      public Match()
    • Match

      public Match​(Match m)
      create a copy of Match object
      to e.g. set another TargetOffset for same match
      Parameters:
      m - other Match
    • Match

      public Match​(Region reg, double sc)
      create a Match from a region with given SimScore
      Parameters:
      reg - Region
      sc - SimScore
    • Match

      public Match​(Region region, IScreen parent)
    • Match

      protected Match​(Rectangle rect, double confidence, String text, Region base)
    • Match

      protected Match​(Rectangle rect, double confidence, String text)
    • Match

      public Match​(int _x, int _y, int _w, int _h, double score, IScreen _parent)
  • Method Details

    • setOnScreen

      public void setOnScreen​(boolean state)
    • getIndex

      public int getIndex()
    • setIndex

      public void setIndex​(int index)
    • setTimes

      public void setTimes​(long ftime, long stime)
      INTERNAL USE set the elapsed times from search
      Parameters:
      ftime - time
      stime - time
    • getTime

      public long getTime()
      Returns:
      this Match's actual waiting time from last successful find
    • create

      public static Match create​(Match match, IScreen screen)
    • getScore

      public double getScore()
      the match score
      Returns:
      a decimal value between 0 (no match) and 1 (exact match)
    • getTarget

      public Location getTarget()
      convenience method
      Overrides:
      getTarget in class Region
      Returns:
      the point defined by target offset (if set) or the center
    • setTargetOffset

      public void setTargetOffset​(Location offset)
      like Pattern.targetOffset sets the click target by offset relative to the center
      Parameters:
      offset - as a Location
    • setTargetOffset

      public void setTargetOffset​(int x, int y)
      like Pattern.targetOffset sets the click target relative to the center
      Parameters:
      x - x offset
      y - y offset
    • getTargetOffset

      public Location getTargetOffset()
      convenience - same as Pattern.getTargetOffset()
      Returns:
      the relative offset to the center
    • setImage

      protected void setImage​(Image img)
      set the image after finding with success
      Parameters:
      img - Image
    • getImage

      public Image getImage()
      get the image used for searching
      Overrides:
      getImage in class Region
      Returns:
      image or null
    • getImageFilename

      public String getImageFilename()
      get the filename of the image used for searching
      Returns:
      filename
    • getText

      public String getText()
      Returns:
      the text stored by findWord, findLine, ...
    • setText

      protected void setText​(String text)
      internally used to set the text found by findWord, findLine, ...
      Parameters:
      text -
    • compareTo

      public int compareTo​(Match m)
      Specified by:
      compareTo in interface Comparable<Match>
    • equals

      public boolean equals​(Object oThat)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Description copied from class: Region
      Overrides:
      toString in class Region
      Returns:
      the description
    • toStringShort

      public String toStringShort()
      Overrides:
      toStringShort in class Region
      Returns:
      a compact description
    • setTarget

      public void setTarget​(int tx, int ty)
      INTERNAL USE
      Parameters:
      tx - x
      ty - y