Subversion Repositories DevTools

Rev

Rev 2116 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2104 ghuddy 1
using System;
2
using System.Collections;
3
 
4
namespace EA_DocGen
5
{
6
   /// <summary>
7
   /// This class is one derived from the EA_UtilitiesRecursionWorker base class so that
8
   /// an instance of it can be used as a parameter in the EA_Utilities.findAndProcessPackageElements
9
   /// method which recursively parses a given package. Thus, clients can parse EA model structure but
10
   /// specify their own functionality to be carried out on packages and elements found in the 
11
   /// parsing.
12
   /// This particular derived class is designed to collect a list of element names from the
13
   /// package, from elements that have a type that is acceptable.
14
   /// </summary>
15
   public class ElementAccumulator : EA_UtilitiesRecursionWorker
16
   {
17
      public ArrayList Elements = null;
2120 ghuddy 18
      public ArrayList ElementIds = null;
2104 ghuddy 19
 
20
      private ArrayList validElementTypes = null;
21
 
2106 ghuddy 22
      public ElementAccumulator(ArrayList elementTypeList): base()
2104 ghuddy 23
      {
24
         validElementTypes = elementTypeList;
25
         Elements = new ArrayList();
2120 ghuddy 26
         ElementIds = new ArrayList();
2104 ghuddy 27
      }
28
 
29
      public override void processElement( EA.Element theElement )
30
      {
31
         if (validElementTypes.Contains( theElement.Type ))
32
         {
33
            //if ( (theElement.Type == "Requirement") && (theElement.Status == "Rejected") )
34
            //   return;
35
 
2116 ghuddy 36
            if (  true == EA_DocGenOptions.optionValue(EA_DocGenOptions.boolean_options_e.SUPPRESS_PRIVATE_CLASSES)
2104 ghuddy 37
               &&    0 == theElement.Type.CompareTo("Class")
38
               && true == theElement.Visibility.StartsWith("Private") )
39
            {
40
               // do nothing
41
            }
2116 ghuddy 42
            else if (   true == EA_DocGenOptions.optionValue(EA_DocGenOptions.boolean_options_e.CONSIDER_API_ELEMENTS_ONLY)
2104 ghuddy 43
               &&    0  > theElement.StereotypeEx.IndexOf("API") )
44
            {
45
               // do nothing
46
            }
47
            else
48
            {
49
               Elements.Add( theElement );
2120 ghuddy 50
               ElementIds.Add( theElement.ElementID );
2104 ghuddy 51
            }
52
         }
53
      }
54
   }
55
 
56
}