      *>----------------------------------------------------------------
      *> This class is used to determine whether a message should be
      *> forwarded on (delegated to) another object, when the original
      *> receiver has not understood the message. This class is used
      *> internally by the class library. Class Library users
      *> are not expected to call this class' methods directly.
      *>
      *> Copyright (C) 1991-1999 Micro Focus International Ltd.
      *>
      *>----------------------------------------------------------------
      $set mfoo

       class-id. DelegateManager data is protected
               inherits from base with data.


        object section.
        class-control.
           base is class "base"
           identityDictionary is class "idictnry"
           Association is class "associtn"
           DelegateManager is class "delegate".

       class-object.

       object-storage section.
       01 delegates usage object reference value null.
      *>----------------------------------------------------------------
      *> PRIVATE. Sets the object lnkObject2 as a delegate for lnkObject
      *>----------------------------------------------------------------
       method-id. "addDelegateFor".
       local-storage section.
       01 aSize pic x(4) comp-5.
       linkage section.
       01 lnkObject    usage object reference.
       01 lnkObject2   usage object reference.
       procedure division using lnkObject lnkObject2.
           if delegates = null
               move 100 to aSize
               invoke IdentityDictionary "ofValues" using Association
                                                          aSize
                                                returning delegates
           end-if
           invoke delegates "atPut" using lnkObject lnkObject2
       end method "addDelegateFor".
      *>----------------------------------------------------------------
      *> PRIVATE. Removes the delegate for lnkObject
      *>----------------------------------------------------------------
       method-id. "remove".
       local-storage section.
       01 aDelegate usage object reference.
       linkage section.
       01 lnkObject    usage object reference.
       procedure division using lnkObject.
           invoke delegates "atOrNil" using lnkObject
                       returning aDelegate
           if aDelegate not = null
               invoke delegates "removeKey" using lnkObject
           end-if
       end method "remove".
      *>----------------------------------------------------------------
      *> PRIVATE. Returns the delegate for lnkeObject if there is one
      *> otherwise null is returned.
      *>----------------------------------------------------------------

       method-id. "getDelegateFor".
       linkage section.
       01 lnkObject            usage object reference.
       01 lnkAnotherObject     usage object reference.
       procedure division using lnkObject returning lnkAnotherObject.
           if delegates not = null
               invoke delegates "atOrNil" using lnkObject
                       returning lnkAnotherObject
           else
               set lnkAnotherObject to null
           end-if
       end method "getDelegateFor".

       end class-object.

       Object.
       object-storage section.
       end object.
       end class DelegateManager.
