PageRenderTime 28ms CodeModel.GetById 23ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/interpreter/tags/at2-build060407/src/edu/vub/at/actors/ATObservable.java

http://ambienttalk.googlecode.com/
Java | 33 lines | 11 code | 5 blank | 17 comment | 0 complexity | f0a06287023c11dde9074ec6988ebe27 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
10public interface ATObservable extends ATObject {
11
12	/**
13	 * Installs an observer on this object
14	 * @param event a symbol denoting a potentially interesting event
15	 * @param observer a closure to be triggered when the event is fired
16	 * @return a closure which can be applied to cancel the observer's subscription
17	 */
18	public abstract ATClosure base_upon_do_(ATSymbol event, ATClosure observer);
19
20	/**
21	 * Fires an event with the given arguments. All the provided closures are applied
22	 * ASYNCHRONOUSLY. This implies that exceptions thrown by such a closure will not
23	 * prevent other observers from getting triggered. Moreover, observers are then
24	 * triggered breadth-first as opposed to depth-first as is the case with synchronous
25	 * invocations.
26	 * 
27	 * @param event - the event being fired
28	 * @param arguments - a possibly empty table of arguments to the event
29	 * @return nil
30	 */
31	public abstract ATNil base_fire_withArgs_(ATSymbol event, NATTable arguments) throws InterpreterException;
32
33}