Subversion Repositories DevTools

Rev

Rev 2106 | 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
   /// Class to sort EA elements alphabetically, in a case insensitive way.
8
   /// This is used by the processRelationshipMatrixElement method.
9
   /// </summary>
10
   public class elementSortByName : IComparer
11
   {
12
      int IComparer.Compare( object x, object y)
13
      {
14
         if (x!=null & y!= null)
15
            return (new CaseInsensitiveComparer()).Compare( ((EA.Element)x).Name, ((EA.Element)y).Name );
16
         else
17
            return 0;
18
      }
19
   }
20
 
2124 ghuddy 21
   /// <summary>
22
   /// This sort is different to the elementSortByName sorter because it assumes the presence of a 
23
   /// requirement tag and so processes it to ensure the number components of the tag have leading zeros
24
   /// thus ensuring the sort outcome is pleasing to the human eye. The field width is limited to what
25
   /// is considered reasonable (ie. 4). Note also that the EA_Utilities.OutlineNumberMunging() function used
26
   /// imposes some constraints, such as the length of the tag, etc. 
27
   /// </summary>
28
   public class elementSortByTAG : IComparer
29
   {
30
      int IComparer.Compare( object x, object y)
31
      {
32
         if (x!=null & y!= null)
33
         {
34
            return (new CaseInsensitiveComparer()).Compare( 
35
               EA_Utilities.OutlineNumberMunging(((EA.Element)x).Name, 4), 
36
               EA_Utilities.OutlineNumberMunging(((EA.Element)y).Name, 4) );
37
         }
38
         else
39
            return 0;
40
      }
41
   }
2104 ghuddy 42
 
43
   public class attributeSortByPos : IComparer
44
   {
45
      int IComparer.Compare( object x, object y)
46
      {
47
         if (x!=null & y!= null)
48
            return ((EA.Attribute)x).Pos - ((EA.Attribute)y).Pos;
49
         else
50
            return 0;
51
      }
52
   }
53
 
54
 
55
   public class methodSortByPos : IComparer
56
   {
57
      int IComparer.Compare( object x, object y)
58
      {
59
         if (x!=null & y!= null)
60
            return ((EA.Method)x).Pos - ((EA.Method)y).Pos;
61
         else
62
            return 0;
63
      }
64
   }
65
 
66
 
67
   public class parameterSortByPos : IComparer
68
   {
69
      int IComparer.Compare( object x, object y)
70
      {
71
         if (x!=null & y!= null)
72
            return ((EA.Parameter)x).Position - ((EA.Parameter)y).Position;
73
         else
74
            return 0;
75
      }
76
   }
77
 
2106 ghuddy 78
   public class glossarySort : IComparer
79
   {
80
      int IComparer.Compare( object x, object y)
81
      {
82
         if (x!=null & y!= null)
83
            return (new CaseInsensitiveComparer()).Compare( ((EA.Term)x).Term, ((EA.Term)y).Term );
84
         else
85
            return 0;
86
      }
87
   }
2104 ghuddy 88
}