Exemple #1
0
        /// <summary>
        /// Checks if a index collection is contained is a list of index collection.
        /// . Properties must be different.
        /// . They must not share an index.
        /// </summary>
        /// <param name="collection">The collection to check.</param>
        /// <param name="collectionList">The list of collections already accumulated.</param>
        public static bool IsCollectionSeparate(IReadOnlyIndexCollection collection, IReadOnlyIndexCollectionReadOnlyList collectionList)
        {
            bool Result = true;

            foreach (IReadOnlyBrowsingChildIndex Index0 in collection.NodeIndexList)
            {
                foreach (IReadOnlyIndexCollection Item in collectionList)
                {
                    if (Item.PropertyName == collection.PropertyName)
                    {
                        Result = false;
                    }

                    foreach (IReadOnlyBrowsingChildIndex Index1 in Item.NodeIndexList)
                    {
                        if (Index0.Equals(Index1))
                        {
                            Result = false;
                        }
                    }
                }
            }

            return(Result);
        }
Exemple #2
0
        public virtual void CheckConsistency()
        {
            IReadOnlyIndexCollectionList         InternalList = InternalIndexCollectionList;
            IReadOnlyIndexCollectionReadOnlyList PublicList   = IndexCollectionList;

            for (int i = 0; i < InternalList.Count; i++)
            {
                IReadOnlyIndexCollection InternalItem = InternalList[i];
                Debug.Assert(PublicList.Contains(InternalItem));
                Debug.Assert(PublicList.IndexOf(InternalItem) >= 0);

                IReadOnlyIndexCollection PublicItem = PublicList[i];
                Debug.Assert(InternalList.Contains(PublicItem));
                Debug.Assert(InternalList.IndexOf(PublicItem) >= 0);

                if (i == 0)
                {
                    Debug.Assert(!((ICollection <IReadOnlyIndexCollection>)InternalList).IsReadOnly);

                    InternalList.Remove(InternalItem);
                    InternalList.Insert(0, InternalItem);

                    IEnumerable <IReadOnlyIndexCollection> AsEnumerable = InternalList;
                    foreach (IReadOnlyIndexCollection Item in AsEnumerable)
                    {
                        Debug.Assert(Item == InternalItem);
                        break;
                    }
                }
            }
        }