/interpreter/tags/at2-build190607/src/edu/vub/at/actors/ATObservable.java
Java | 39 lines | 11 code | 5 blank | 23 comment | 0 complexity | c8da01f7598e72ebfd190ca49dceb112 MD5 | raw file
1package edu.vub.at.actors; 2 3import edu.vub.at.exceptions.InterpreterException; 4import edu.vub.at.objects.ATClosure; 5import edu.vub.at.objects.ATNil; 6import edu.vub.at.objects.ATObject; 7import edu.vub.at.objects.grammar.ATSymbol; 8import edu.vub.at.objects.natives.NATTable; 9 10/** 11 * ATObservable is the common interface used to create callbacks. 12 * 13 * @author smostinc 14 * @deprecated 15 */ 16public interface ATObservable extends ATObject { 17 18 /** 19 * Installs an observer on this object 20 * @param event a symbol denoting a potentially interesting event 21 * @param observer a closure to be triggered when the event is fired 22 * @return a closure which can be applied to cancel the observer's subscription 23 */ 24 public abstract ATClosure base_upon_do_(ATSymbol event, ATClosure observer); 25 26 /** 27 * Fires an event with the given arguments. All the provided closures are applied 28 * ASYNCHRONOUSLY. This implies that exceptions thrown by such a closure will not 29 * prevent other observers from getting triggered. Moreover, observers are then 30 * triggered breadth-first as opposed to depth-first as is the case with synchronous 31 * invocations. 32 * 33 * @param event - the event being fired 34 * @param arguments - a possibly empty table of arguments to the event 35 * @return nil 36 */ 37 public abstract ATNil base_fire_withArgs_(ATSymbol event, NATTable arguments) throws InterpreterException; 38 39}