      *>----------------------------------------------------------------
      *>  ArrayedCollection is an abstract class which represents the
      *>  common behavior for all fixed size indexed collections.
      *>
      *> Copyright (C) 1991-1999 Micro Focus International Ltd.
      *>
      *>----------------------------------------------------------------
      $set linkcount(150) mfoo

       class-id. ArrayedCollection is abstract data is protected
                     inherits from sequencedcollection with data.


        object section.
        class-control.
           sequencedcollection is class "sequence"
           arrayedcollection is class "arrayed"
           callback is class "callback".

       class-object.

       object-storage section.

      *>----------------------------------------------------------------
      *> PRIVATE. Used to implement withall.
      *>----------------------------------------------------------------
       method-id. "withAllBM".
       linkage section.
       01 lnkindex              pic s9(9) comp-5.
       01 anewcollection       usage object reference.
       01 anelement            pic x.
       procedure division using lnkindex anewcollection anelement.
           add 1 to lnkindex
           invoke anewcollection "atPut" using lnkindex anelement
           exit method.
       end method "withAllBM".
      *>----------------------------------------------------------------
      *> Create an instance of a Collection with the same members as
      *> aCollection.
      *>----------------------------------------------------------------
       method-id. "withAll".
       local-storage section.

       01 anobject             usage object reference.
       01 anobject2            usage object reference.
       01 messageselector      pic x(80).
       01 ooreturnptr          usage pointer.
       01 abm                  usage object reference.
       01 i                    pic s9(9) comp-5.
       01 atemplate2           usage object reference.


       linkage section.

       01 anewcollection       usage object reference.
       01 acollection          usage object reference.

       procedure division using acollection
                       returning anewcollection.
           invoke acollection "template" returning atemplate2
           invoke acollection "size" returning i
           invoke self "ofValues" using atemplate2 i
                               returning anewcollection
           move zero to i
           move "withAllBM" to messageselector
           invoke callback "new" using self messageselector
                                       i anewcollection
                             returning abm
           invoke acollection "do" using abm
           invoke abm "finalize" returning anobject
           exit method.
       end method "withAll".

       end class-object.

       Object.

       object-storage section.

      *>---------------------------------------------------------------
      *> Raise an exception as elements cannot be added to instances of
      *> ArrayedCollection.
      *>---------------------------------------------------------------
       method-id. "add".
       local-storage section.
       01 exceptionnumber      pic s9(9) comp-5.

       linkage section.
       01 avoidparam           pic x.

       procedure division using avoidparam.
           move 1 to exceptionnumber
           invoke self "raiseException" using exceptionnumber
           exit method.
       end method "add".
       end object.
       end class arrayedcollection.
