Rev 2106 | Blame | Compare with Previous | Last modification | View Log | RSS feed
using System;using System.Collections;namespace EA_DocGen{/// <summary>/// Class to sort EA elements alphabetically, in a case insensitive way./// This is used by the processRelationshipMatrixElement method./// </summary>public class elementSortByName : IComparer{int IComparer.Compare( object x, object y){if (x!=null & y!= null)return (new CaseInsensitiveComparer()).Compare( ((EA.Element)x).Name, ((EA.Element)y).Name );elsereturn 0;}}/// <summary>/// This sort is different to the elementSortByName sorter because it assumes the presence of a/// requirement tag and so processes it to ensure the number components of the tag have leading zeros/// thus ensuring the sort outcome is pleasing to the human eye. The field width is limited to what/// is considered reasonable (ie. 4). Note also that the EA_Utilities.OutlineNumberMunging() function used/// imposes some constraints, such as the length of the tag, etc./// </summary>public class elementSortByTAG : IComparer{int IComparer.Compare( object x, object y){if (x!=null & y!= null){return (new CaseInsensitiveComparer()).Compare(EA_Utilities.OutlineNumberMunging(((EA.Element)x).Name, 4),EA_Utilities.OutlineNumberMunging(((EA.Element)y).Name, 4) );}elsereturn 0;}}public class attributeSortByPos : IComparer{int IComparer.Compare( object x, object y){if (x!=null & y!= null)return ((EA.Attribute)x).Pos - ((EA.Attribute)y).Pos;elsereturn 0;}}public class methodSortByPos : IComparer{int IComparer.Compare( object x, object y){if (x!=null & y!= null)return ((EA.Method)x).Pos - ((EA.Method)y).Pos;elsereturn 0;}}public class parameterSortByPos : IComparer{int IComparer.Compare( object x, object y){if (x!=null & y!= null)return ((EA.Parameter)x).Position - ((EA.Parameter)y).Position;elsereturn 0;}}public class glossarySort : IComparer{int IComparer.Compare( object x, object y){if (x!=null & y!= null)return (new CaseInsensitiveComparer()).Compare( ((EA.Term)x).Term, ((EA.Term)y).Term );elsereturn 0;}}}