bool IDictionary <TKey, IFocusAssignableCellView> .TryGetValue(TKey key, out IFocusAssignableCellView value)
        {
            bool Result = TryGetValue(key, out ILayoutAssignableCellView Value);

            value = Value;
            return(Result);
        }
        /// <summary>
        /// Compares two <see cref="IFocusAssignableCellViewReadOnlyDictionary{TKey}"/> objects.
        /// </summary>
        /// <param name="comparer">The comparison support object.</param>
        /// <param name="other">The other object.</param>
        public virtual bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            Debug.Assert(other != null);

            if (!comparer.IsSameType(other, out FocusAssignableCellViewReadOnlyDictionary <TKey> AsAssignableCellViewReadOnlyDictionary))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameCount(Count, AsAssignableCellViewReadOnlyDictionary.Count))
            {
                return(comparer.Failed());
            }

            foreach (KeyValuePair <TKey, IFocusAssignableCellView> Entry in this)
            {
                Debug.Assert(Entry.Key != null);

                if (!comparer.IsTrue(AsAssignableCellViewReadOnlyDictionary.ContainsKey(Entry.Key)))
                {
                    return(comparer.Failed());
                }

                IFocusAssignableCellView OtherValue = AsAssignableCellViewReadOnlyDictionary[Entry.Key] as IFocusAssignableCellView;

                if (!comparer.IsTrue((Entry.Value != null && OtherValue != null) || (Entry.Value == null && OtherValue == null)))
                {
                    return(comparer.Failed());
                }

                if (Entry.Value != null)
                {
                    if (!comparer.VerifyEqual(Entry.Value, OtherValue))
                    {
                        return(comparer.Failed());
                    }
                }
            }

            return(true);
        }
Beispiel #3
0
        /// <inheritdoc/>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            Contract.RequireNotNull(other, out IEqualComparable Other);

            if (!comparer.IsSameType(Other, out FocusAssignableCellViewReadOnlyDictionary <TKey> AsOtherReadOnlyDictionary))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameCount(Count, AsOtherReadOnlyDictionary.Count))
            {
                return(comparer.Failed());
            }

            foreach (TKey Key in Keys)
            {
                if (!comparer.IsTrue(AsOtherReadOnlyDictionary.ContainsKey(Key)))
                {
                    return(comparer.Failed());
                }

                IFocusAssignableCellView ThisValue  = (IFocusAssignableCellView)this[Key];
                IFocusAssignableCellView OtherValue = (IFocusAssignableCellView)AsOtherReadOnlyDictionary[Key];

                if (!comparer.IsTrue((ThisValue is null && OtherValue is null) || (ThisValue is not null && OtherValue is not null)))
                {
                    return(comparer.Failed());
                }

                if (ThisValue is not null)
                {
                    if (!comparer.VerifyEqual(ThisValue, OtherValue))
                    {
                        return(comparer.Failed());
                    }
                }
            }

            return(true);
        }
        /// <inheritdoc/>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            Contract.RequireNotNull(other, out IEqualComparable Other);

            if (!comparer.IsSameType(Other, out FocusAssignableCellViewDictionary<TKey> AsOtherDictionary))
                return comparer.Failed();

            if (!comparer.IsSameCount(Count, AsOtherDictionary.Count))
                return comparer.Failed();

            foreach (TKey Key in Keys)
            {
                IFocusAssignableCellView Value = (IFocusAssignableCellView)this[Key];

                if (!comparer.IsTrue(AsOtherDictionary.ContainsKey(Key)))
                    return comparer.Failed();

                if (!comparer.VerifyEqual(Value, AsOtherDictionary[Key]))
                    return comparer.Failed();
            }

            return true;
        }
Beispiel #5
0
 void IDictionary <TKey, IFocusAssignableCellView> .Add(TKey key, IFocusAssignableCellView value)
 {
     throw new NotSupportedException("Collection is read-only.");
 }
Beispiel #6
0
 bool IReadOnlyDictionary <TKey, IFocusAssignableCellView> .TryGetValue(TKey key, out IFocusAssignableCellView value)
 {
     bool Result = TryGetValue(key, out IFrameAssignableCellView Value); value = (IFocusAssignableCellView)Value; return(Result);
 }
 void IDictionary<TKey, IFocusAssignableCellView>.Add(TKey key, IFocusAssignableCellView value) { Add(key, value); }