/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

  1. package edu.vub.at.actors;
  2. import edu.vub.at.exceptions.InterpreterException;
  3. import edu.vub.at.objects.ATClosure;
  4. import edu.vub.at.objects.ATNil;
  5. import edu.vub.at.objects.ATObject;
  6. import edu.vub.at.objects.grammar.ATSymbol;
  7. import edu.vub.at.objects.natives.NATTable;
  8. public interface ATObservable extends ATObject {
  9. /**
  10. * Installs an observer on this object
  11. * @param event a symbol denoting a potentially interesting event
  12. * @param observer a closure to be triggered when the event is fired
  13. * @return a closure which can be applied to cancel the observer's subscription
  14. */
  15. public abstract ATClosure base_upon_do_(ATSymbol event, ATClosure observer);
  16. /**
  17. * Fires an event with the given arguments. All the provided closures are applied
  18. * ASYNCHRONOUSLY. This implies that exceptions thrown by such a closure will not
  19. * prevent other observers from getting triggered. Moreover, observers are then
  20. * triggered breadth-first as opposed to depth-first as is the case with synchronous
  21. * invocations.
  22. *
  23. * @param event - the event being fired
  24. * @param arguments - a possibly empty table of arguments to the event
  25. * @return nil
  26. */
  27. public abstract ATNil base_fire_withArgs_(ATSymbol event, NATTable arguments) throws InterpreterException;
  28. }