ORIGIN '~beta/basiclib/betaenv'; INCLUDE '~beta/containers/sets'; -- lib: Attributes -- Subject: (# observerType:< Observer; init:< (# do observers.init; INNER ; #); attach: (# theObserver: ^observerType; enter theObserver[] do theObserver[]->observers.insert; #); detach: (# theObserver: ^observerType; enter theObserver[] do theObserver[]->observers.delete #); notify: (# current: ^observerType; do observers.scan (# do (if not current.ignore then current[]->THIS(notify).current[]; INNER notify; if); #); #); notifyUpdate: notify (# do current.Update; #); notifyOfType: (# type:< Observer; current: ^type; do observers.scan (# do (if not current.ignore then (if current## <= type## then current[]->THIS(notifyOfType).current[]; INNER notifyOfType; if); if); #); #); observers: @set (# element:: observerType #); #); Observer: (# ignore:< booleanValue; update:< (# do INNER #); #)
13.8 Observer Interface | © 1991-2002 Mjølner Informatics |
[Modified: Tuesday January 25th 2000 at 13:08]
|