Package org.sikuli.script
Class Match
- java.lang.Object
-
- org.sikuli.script.Element
-
- org.sikuli.script.Region
-
- org.sikuli.script.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
Regionand holds:- the match score (0 ... 1.0)
getScore() - the click target
getTarget()(e.g. fromPattern) - a ref to the image used for search
getImage()orgetImageFilename() - the found text
getText()in case of text find ops
-
-
Field Summary
-
Fields inherited from class org.sikuli.script.Region
BB, BH, BL, BM, BOTTOM, BR, C2, CH, CV, EAST, EAST_MID, EAST_NORTH, EAST_SOUTH, EH, EM, EN, ES, LB, LEFT, LH, LL, LM, logName, LT, M2, M3, MH, MID_HORIZONTAL, MID_VERTICAL, MIDDLE, MIDDLE_BIG, MM, MV, NE, NH, NM, NORTH, NORTH_EAST, NORTH_MID, NORTH_WEST, NW, otherScreen, RB, RH, RIGHT, RM, RR, RT, SE, SH, SM, SOUTH, SOUTH_EAST, SOUTH_MID, SOUTH_WEST, SW, TH, TL, TM, TOP, TR, TT, WEST, WEST_MID, WEST_NORTH, WEST_SOUTH, WH, WM, WN, WS
-
Fields inherited from class org.sikuli.script.Element
h, imageMissingHandler, lastMatch, lastMatches, lastSearchTimeRepeat, logLevel, w, x, y
-
-
Constructor Summary
Constructors Modifier Constructor Description Match()Match(int _x, int _y, int _w, int _h, double score, IScreen _parent)protectedMatch(Rectangle rect, double confidence, String text)protectedMatch(Rectangle rect, double confidence, String text, Region base)Match(Match m)create a copy of Match object
to e.g. set another TargetOffset for same matchMatch(Region reg, double sc)create a Match from a region with given SimScoreMatch(Region region, IScreen parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Match m)static Matchcreate(Match match, IScreen screen)booleanequals(Object oThat)ImagegetImage()get the image used for searchingStringgetImageFilename()get the filename of the image used for searchingintgetIndex()doublegetScore()the match scoreLocationgetTarget()convenience methodLocationgetTargetOffset()convenience - same asPattern.getTargetOffset()StringgetText()longgetTime()protected voidsetImage(Image img)set the image after finding with successvoidsetIndex(int index)voidsetOnScreen(boolean state)voidsetTarget(int tx, int ty)INTERNAL USEvoidsetTargetOffset(int x, int y)likePattern.targetOffsetsets the click target relative to the centervoidsetTargetOffset(Location offset)likePattern.targetOffsetsets the click target by offset relative to the centerprotected voidsetText(String text)internally used to set the text found by findWord, findLine, ...voidsetTimes(long ftime, long stime)INTERNAL USE set the elapsed times from searchStringtoString()StringtoStringShort()-
Methods inherited from class org.sikuli.script.Region
above, above, aboveAt, aboveAt, add, add, add, aInput, aKey, asOffset, aSwipe, aSwipeDown, aSwipeLeft, aSwipeRight, aSwipeUp, aTap, atMouse, below, below, belowAt, belowAt, checkMatch, click, click, click, contains, contains, containsMouse, copyTo, copyTo, create, create, create, create, create, create, create, delayClick, delayType, doHighlight, doubleClick, doubleClick, doubleClick, drag, dragDrop, dragDrop, dropAt, exists, exists, existsText, existsText, find, findAll, findAllByColumn, findAllByRow, findAllList, findAllText, findAny, findAnyList, findBest, findBestList, findText, get, getAll, getAutoWaitTimeout, getBottomLeft, getBottomRight, getCell, getCenter, getCol, getCol, getCols, getColW, getDefaultInstance4py, getEvent, getEvents, getFakeRegion, getFindFailedResponse, getInset, getLastScreenImage, getLastScreenImageFile, getLastScreenImageFile, getLastScreenImageFile, getLocationFromTarget, getObserver, getObserveScanRate, getRect, getRectangle, getRepeatWaitTime, getROI, getRow, getRow, getRowH, getRows, getScreen, getScreenContaining, getThrowException, getTopLeft, getTopRight, getWaitScanRate, grow, grow, grow, grow, grow, grow, grow, has, has, hasEvents, hasObserver, hasText, highlight, highlight, highlight, highlight, highlight4py, highlightAllOff, highlightOff, highlightOn, highlightOn, hover, hover, initScreen, inside, internalUseOnlyHighlightReset, intersection, isObserving, isOtherScreen, isRasterValid, isValid, isVirtual, keyDown, keyDown, keyUp, keyUp, keyUp, left, left, leftAt, leftAt, make4py, morphTo, mouseDown, mouseMove, mouseMove, mouseMove, mouseUp, mouseUp, moveTo, nearby, nearby, observe, observe, observeInBackground, observeInBackground, observeInLine, offset, offset, onAppear, onAppear, onChange, onChange, onChange, onChange, onVanish, onVanish, paste, paste, regionOnScreen, relocate, relocate, resetFindFailedResponse, resetScreens, resetThrowException, right, right, rightAt, rightAt, rightClick, rightClick, rightClick, saveCapture, saveLastScreenImage, setActive, setAutoWaitTimeout, setBottomLeft, setBottomRight, setCenter, setCols, setFindFailedHandler, setFindFailedResponse, setH, setInactive, setLocation, setObserveScanRate, setOtherScreen, setOtherScreen, setRaster, setRect, setRect, setRect, setRepeatWaitTime, setROI, setROI, setROI, setROI, setRows, setScreen, setScreen, setSize, setThrowException, setTopLeft, setTopRight, setVirtual, setW, setWaitScanRate, setX, setY, showScreens, stopObserver, stopObserver, toGlobalCoord, type, type, type, type, type, type, union, unionAll, unionAny, unionAnyList, virtual, wait, wait, wait, waitAny, waitAnyList, waitBest, waitBestList, waitT, waitT, waitText, waitText, waitVanish, waitVanish, wheel, wheel, wheel, write
-
Methods inherited from class org.sikuli.script.Element
collectLines, collectLinesText, collectWords, collectWordsText, existsT, findAllT, findLine, findLines, findLines, findT, findWord, findWords, findWords, getBufferedImage, getH, getImageFromTarget, getLastMatch, getLastMatches, getName, getW, getX, getY, hasT, isEmpty, log, returnThis, setImageMissingHandler, setName, text, textChar, textLine, textLines, textWord, textWords
-
-
-
-
Constructor Detail
-
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- Regionsc- SimScore
-
Match
public Match(int _x, int _y, int _w, int _h, double score, IScreen _parent)
-
-
Method Detail
-
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- timestime- time
-
getTime
public long getTime()
- Returns:
- this Match's actual waiting time from last successful find
-
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
-
setTargetOffset
public void setTargetOffset(Location offset)
likePattern.targetOffsetsets the click target by offset relative to the center- Parameters:
offset- as a Location
-
setTargetOffset
public void setTargetOffset(int x, int y)likePattern.targetOffsetsets the click target relative to the center- Parameters:
x- x offsety- y offset
-
getTargetOffset
public Location getTargetOffset()
convenience - same asPattern.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
-
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:
compareToin interfaceComparable<Match>
-
toStringShort
public String toStringShort()
- Overrides:
toStringShortin classRegion- Returns:
- a compact description
-
setTarget
public void setTarget(int tx, int ty)INTERNAL USE- Parameters:
tx- xty- y
-
-