/interpreter/tags/at2dist130208/src/edu/vub/at/actors/ATObservable.java

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