Class ObserveEvent

    • 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 - name
        type - type
        v1 - value 1
        v2 - value 2
        v3 - value 3
        now - 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)
      • getChanges

        public List<Match> getChanges()
        Returns:
        a list of observed changes as matches (CHANGE)
      • setChanges

        public void setChanges​(List<Match> actualChanges)
      • 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)
      • 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