Package org.sikuli.script
Class ObserveEvent
- java.lang.Object
-
- org.sikuli.script.ObserveEvent
-
- Direct Known Subclasses:
SikuliEvent
public class ObserveEvent extends Object
provides information about the observed event being in theObserverCallBack
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObserveEvent.Type
-
Constructor Summary
Constructors Constructor Description ObserveEvent()ObserveEvent(String name, ObserveEvent.Type type, Object v1, Object v2, Object v3, long now)INTERNAL: creates an observed event
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Match>getChanges()intgetCount()ImagegetImage()MatchgetMatch()StringgetName()PatterngetPattern()RegiongetRegion()FindFailedResponsegetResponse()longgetTime()StringgetType()get the observe event typeObject[]getVals()for type GENERIC: (the value's type is known by creator and user of getVals as some private protocol)booleanisAppear()check the observe event typebooleanisChange()check the observe event typebooleanisFindFailed()check the observe event typebooleanisGeneric()check the observe event typebooleanisMissing()check the observe event typebooleanisVanish()check the observe event typevoidrepeat()tell the observer to repeat this event's observe action immediately after returning from this handler (APPEAR, VANISH)voidrepeat(long secs)tell the observer to repeat this event's observe action after given time in secs after returning from this handler (APPEAR, VANISH)voidsetActive()voidsetChanges(List<Match> actualChanges)voidsetImage(Object img)voidsetInactive()voidsetIndex(int index)voidsetMatch(Object m)voidsetPattern(Object p)voidsetRegion(Object r)voidsetResponse(FindFailedResponse resp)protected voidsetVals(Object v1, Object v2, Object v3)for type GENERIC: 3 values can be stored in the event (the value's type is known by creator and user of getVals as some private protocol)voidstopObserver()stops the observervoidstopObserver(String text)stops the observer and prints the given textStringtoString()
-
-
-
Constructor Detail
-
ObserveEvent
public ObserveEvent()
-
ObserveEvent
public ObserveEvent(String name, ObserveEvent.Type type, Object v1, Object v2, Object v3, long now)
INTERNAL: creates an observed event- Parameters:
name- nametype- typev1- value 1v2- value 2v3- value 3now- now
-
-
Method Detail
-
getType
public String getType()
get the observe event type- Returns:
- a string containing either APPEAR, VANISH, CHANGE or GENERIC
-
isAppear
public boolean isAppear()
check the observe event type- Returns:
- true if it is APPEAR, false otherwise
-
isVanish
public boolean isVanish()
check the observe event type- Returns:
- true if it is VANISH, false otherwise
-
isChange
public boolean isChange()
check the observe event type- Returns:
- true if it is CHANGE, false otherwise
-
isGeneric
public boolean isGeneric()
check the observe event type- Returns:
- true if it is GENERIC, false otherwise
-
isFindFailed
public boolean isFindFailed()
check the observe event type- Returns:
- true if it is FINDFAILED, false otherwise
-
isMissing
public boolean isMissing()
check the observe event type- Returns:
- true if it is MISSING, false otherwise
-
setActive
public void setActive()
-
setInactive
public void setInactive()
-
setVals
protected void setVals(Object v1, Object v2, Object v3)
for type GENERIC: 3 values can be stored in the event (the value's type is known by creator and user of getVals as some private protocol)- Parameters:
v1-v2-v3-
-
getVals
public Object[] getVals()
for type GENERIC: (the value's type is known by creator and user of getVals as some private protocol)- Returns:
- an array with the 3 stored values (might be null)
-
getName
public String getName()
- Returns:
- the observer name of this event
-
getRegion
public Region getRegion()
- Returns:
- this event's observer's region
-
setRegion
public void setRegion(Object r)
-
getMatch
public Match getMatch()
- Returns:
- the observed match (APEAR, VANISH)
-
setMatch
public void setMatch(Object m)
-
setIndex
public void setIndex(int index)
-
getPattern
public Pattern getPattern()
- Returns:
- the used pattern for this event's observing
-
setPattern
public void setPattern(Object p)
-
getImage
public Image getImage()
-
setImage
public void setImage(Object img)
-
setResponse
public void setResponse(FindFailedResponse resp)
-
getResponse
public FindFailedResponse getResponse()
-
getTime
public long getTime()
-
repeat
public void repeat()
tell the observer to repeat this event's observe action immediately after returning from this handler (APPEAR, VANISH)
-
repeat
public void repeat(long secs)
tell the observer to repeat this event's observe action after given time in secs after returning from this handler (APPEAR, VANISH)- Parameters:
secs- seconds
-
getCount
public int getCount()
- Returns:
- the number how often this event has already been triggered until now
-
stopObserver
public void stopObserver()
stops the observer
-
stopObserver
public void stopObserver(String text)
stops the observer and prints the given text- Parameters:
text- text
-
-