/* 1999-2003, Rony G. Flatscher, Wirtschaftsuniversitaet Wien, Austria, Europe
   A *possible* solution to excercise: 12 (1)
*/

::CLASS Manager         SUBCLASS Class  PUBLIC

::METHOD Init
  EXPOSE Managed_Objects
  Managed_Objects = .bag~new
  self~init:super

::METHOD Managed_Objects ATTRIBUTE

::METHOD New
  FORWARD CLASS (super) CONTINUE
  tmpObj = RESULT
  self~Managed_Objects~put(tmpObj)
  RETURN tmpObj

::METHOD Broadcast
  USE ARG message, bSynchroneously
  bSynchroneously = (bSynchroneously=.true)
  IF bSynchroneously THEN SAY "Manager.Broadcast: invoking messages synchroneously..."
                     ELSE SAY "Manager.Broadcast: invoking messages asynchroneously..."

  DO item OVER self~Managed_Objects
     IF bSynchroneously THEN message~copy~send(item)
                        ELSE message~copy~start(item)
  END