예제 #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!(obj is IGroup))
            {
                return(false);
            }

            IGroup group = (IGroup)obj;

            if (this.Order != group.Order)
            {
                return(false);
            }

            return(GroupUtilities.AreEqual(this, group));
        }
예제 #2
0
        internal static List <IGroup> GroupsClosure(ICollection <IGroup> initialGroups)
        {
            List <IGroup> groups        = new List <IGroup>(initialGroups);
            int           lastprocessed = 0;

            while (lastprocessed < groups.Count)
            {
                List <IGroup> newgroups = new List <IGroup>();

                for (int k = 0; k < groups.Count; k++)
                {
                    for (int j = lastprocessed; j < groups.Count; j++)
                    {
                        IGroup newgroup = GroupUtilities.Multiply(groups[k], groups[j]);

                        if (!newgroups.Contains(newgroup) && !groups.Contains(newgroup))
                        {
                            newgroups.Add(newgroup);
                        }

                        newgroup = GroupUtilities.Multiply(groups[j], groups[k]);

                        if (!newgroups.Contains(newgroup) && !groups.Contains(newgroup))
                        {
                            newgroups.Add(newgroup);
                        }
                    }
                }

                lastprocessed = groups.Count;

                groups.AddRange(newgroups);
            }

            return(groups);
        }