private void callVanishObserver(Object ptn, Match m) { SikuliEventVanish se = new SikuliEventVanish(ptn, m, _region); Object ao = _vanishOb.get(ptn); Observer.addEvent(_names.get(ptn), se); if (ao != null && ao instanceof SikuliEventObserver) { ((SikuliEventObserver) _vanishOb.get(ptn)).targetVanished(se); } }
private void callAppearObserver(Object ptn, Match m) { SikuliEventAppear se = new SikuliEventAppear(ptn, m, _region); Object ao = _appearOb.get(ptn); Observer.addEvent(_names.get(ptn), se); if (ao != null && ao instanceof SikuliEventObserver) { ((SikuliEventObserver) _appearOb.get(ptn)).targetAppeared(se); } }
private void callChangeObserver(FindResults results) throws AWTException { for (Integer n : _changeOb.keySet()) { List<Match> changes = new ArrayList<Match>(); for (int i = 0; i < results.size(); i++) { FindResult r = results.get(i); if (r.getW() * r.getH() >= n) { changes.add(_region.toGlobalCoord(new Match(r, _region.getScreen()))); } } if (changes.size() > 0) { _countc.put(n, _countc.get(n) + 1); SikuliEventChange se = new SikuliEventChange(changes, _region); Object ao = _changeOb.get(n); Observer.addEvent(_cnames.get(n), se); if (ao instanceof SikuliEventObserver) { ((SikuliEventObserver) _changeOb.get(n)).targetChanged(se); } } } }