Subversion Repositories DevTools

Rev

Rev 2106 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

using System;
using System.Collections;

namespace EA_DocGen
{
   /// <summary>
   /// This class is one derived from the EA_UtilitiesRecursionWorker 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 ElementAccumulator : EA_UtilitiesRecursionWorker
   {
      public ArrayList Elements = null;

      private ArrayList validElementTypes = null;

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

      public override void processElement( EA.Element theElement )
      {
         if (validElementTypes.Contains( theElement.Type ))
         {
            //if ( (theElement.Type == "Requirement") && (theElement.Status == "Rejected") )
            //   return;

            if (  true == EA_DocGenOptions.optionValue(EA_DocGenOptions.boolean_options_e.SUPPRESS_PRIVATE_CLASSES)
               &&    0 == theElement.Type.CompareTo("Class")
               && true == theElement.Visibility.StartsWith("Private") )
            {
               // do nothing
            }
            else if (   true == EA_DocGenOptions.optionValue(EA_DocGenOptions.boolean_options_e.CONSIDER_API_ELEMENTS_ONLY)
               &&    0  > theElement.StereotypeEx.IndexOf("API") )
            {
               // do nothing
            }
            else
            {
               Elements.Add( theElement );
            }
         }
      }
   }

}