Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

using System;
using System.Collections;

namespace EA_ReqPro
{
        /// <summary>
   /// This class is one derived from the EA_RecursionWorker base class so that
   /// an instance of it can be used as a parameter in the EA_Utilities.findAndProcessPackageElements
   /// method which recursively parses a given package. Thus, clients can parse EA model structure but
   /// specify their own functionality to be carried out on packages and elements found in the
   /// parsing.
   /// This particular derived class is designed to collect a list of element names from the
   /// package, from elements that have a type that is acceptable.
        /// </summary>
   public class EA_ElementAccumulator : EA_RecursionWorker
   {
      public ArrayList Elements = null;
      public ArrayList ElementIDs = null;
      private ArrayList validElementTypes = null;

      public EA_ElementAccumulator(ArrayList elementTypeList): base()
      {
         validElementTypes = elementTypeList;
         Elements = new ArrayList();
         ElementIDs = new ArrayList();
      }

      public override void processElement( EA.Element theElement )
      {
         if (validElementTypes.Contains( theElement.Type ))
         {
            Elements.Add( theElement );
            ElementIDs.Add( theElement.ElementID );
         }
      }
   }
}