Exemple #1
0
        /// <summary>
        /// Compares two <see cref="FrameSourceStateView"/> objects.
        /// </summary>
        /// <param name="comparer">The comparison support object.</param>
        /// <param name="other">The other object.</param>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            Contract.RequireNotNull(other, out IEqualComparable Other);

            if (!comparer.IsSameType(Other, out FrameSourceStateView AsSourceStateView))
            {
                return(comparer.Failed());
            }

            if (!base.IsEqual(comparer, AsSourceStateView))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameReference(Template, AsSourceStateView.Template))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsTrue((RootCellView == null || AsSourceStateView.RootCellView != null) && (RootCellView != null || AsSourceStateView.RootCellView == null)))
            {
                return(comparer.Failed());
            }

            if (RootCellView != null)
            {
                Debug.Assert(CellViewTable != null);
                Debug.Assert(AsSourceStateView.CellViewTable != null);

                if (!comparer.VerifyEqual(RootCellView, AsSourceStateView.RootCellView))
                {
                    return(comparer.Failed());
                }

                if (!comparer.VerifyEqual(CellViewTable, AsSourceStateView.CellViewTable))
                {
                    return(comparer.Failed());
                }
            }

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

            if (!comparer.IsSameType(other, out FramePlaceholderNodeStateView AsPlaceholderNodeStateView))
            {
                return(comparer.Failed());
            }

            if (!base.IsEqual(comparer, AsPlaceholderNodeStateView))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameReference(Template, AsPlaceholderNodeStateView.Template))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsTrue((RootCellView == null || AsPlaceholderNodeStateView.RootCellView != null) && (RootCellView != null || AsPlaceholderNodeStateView.RootCellView == null)))
            {
                return(comparer.Failed());
            }

            if (RootCellView != null)
            {
                Debug.Assert(CellViewTable != null);
                Debug.Assert(AsPlaceholderNodeStateView.CellViewTable != null);

                if (!comparer.VerifyEqual(RootCellView, AsPlaceholderNodeStateView.RootCellView))
                {
                    return(comparer.Failed());
                }

                if (!comparer.VerifyEqual(CellViewTable, AsPlaceholderNodeStateView.CellViewTable))
                {
                    return(comparer.Failed());
                }
            }

            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Compares two <see cref="FrameCellView"/> 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)
        {
            if (!comparer.IsSameType(other, out FrameCellView AsCellView))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(StateView, AsCellView.StateView))
            {
                return(comparer.Failed());
            }

            return(true);
        }
Exemple #4
0
        /// <summary>
        /// Compares two <see cref="FrameContainerCellView"/> objects.
        /// </summary>
        /// <param name="comparer">The comparison support object.</param>
        /// <param name="other">The other object.</param>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            if (!comparer.IsSameType(other, out FrameContainerCellView AsContainerCellView))
            {
                return(comparer.Failed());
            }

            if (!base.IsEqual(comparer, AsContainerCellView))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(ParentCellView, AsContainerCellView.ParentCellView))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(ChildStateView, AsContainerCellView.ChildStateView))
            {
                return(comparer.Failed());
            }

            return(true);
        }
        private bool IsEqualMatchTable(CompareEqual comparer, ReadOnlyController other, IDictionary <IReadOnlyIndex, IReadOnlyIndex> matchTable)
        {
            foreach (KeyValuePair <IReadOnlyIndex, IReadOnlyIndex> Entry in matchTable)
            {
                IReadOnlyNodeState State      = StateTable[Entry.Key];
                IReadOnlyNodeState OtherState = other.StateTable[Entry.Value];

                if (!comparer.VerifyEqual(State, OtherState))
                {
                    return(comparer.Failed());
                }
            }

            return(true);
        }
        private bool IsEqualFields(CompareEqual comparer, ReadOnlyController other)
        {
            if (!comparer.VerifyEqual(RootIndex, other.RootIndex))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(RootState, other.RootState))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(Stats, other.Stats))
            {
                return(comparer.Failed());
            }

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

            return(true);
        }
Exemple #7
0
        private protected virtual bool IsEmbeddingCellViewEqual(CompareEqual comparer, IFrameBlockStateView other)
        {
            if (!comparer.IsTrue((EmbeddingCellView == null && other.EmbeddingCellView == null) || (EmbeddingCellView != null && other.EmbeddingCellView != null)))
            {
                return(comparer.Failed());
            }

            if (EmbeddingCellView != null)
            {
                if (!comparer.VerifyEqual(EmbeddingCellView, other.EmbeddingCellView))
                {
                    return(comparer.Failed());
                }
            }

            return(true);
        }
Exemple #8
0
        /// <summary>
        /// Compares two <see cref="FrameCellViewCollection"/> objects.
        /// </summary>
        /// <param name="comparer">The comparison support object.</param>
        /// <param name="other">The other object.</param>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            if (!comparer.IsSameType(other, out FrameCellViewCollection AsCellViewCollection))
            {
                return(comparer.Failed());
            }

            if (!base.IsEqual(comparer, AsCellViewCollection))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(CellViewList, AsCellViewCollection.CellViewList))
            {
                return(comparer.Failed());
            }

            return(true);
        }
        /// <summary>
        /// Compares two <see cref="ILayoutAssignableCellViewReadOnlyDictionary{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 LayoutAssignableCellViewReadOnlyDictionary <TKey> AsAssignableCellViewReadOnlyDictionary))
            {
                return(comparer.Failed());
            }

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

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

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

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

                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);
        }
Exemple #10
0
        /// <inheritdoc/>
        public virtual bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            Contract.RequireNotNull(other, out IEqualComparable Other);

            if (!comparer.IsSameType(Other, out ReadOnlyInner <IIndex> AsInner))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(Owner, AsInner.Owner))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameString(PropertyName, AsInner.PropertyName))
            {
                return(comparer.Failed());
            }

            return(true);
        }
Exemple #11
0
        /// <summary>
        /// Compares two <see cref="IReadOnlyInner"/> 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 ReadOnlyInner <IIndex> AsInner))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(Owner, AsInner.Owner))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameString(PropertyName, AsInner.PropertyName))
            {
                return(comparer.Failed());
            }

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

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

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

            foreach (KeyValuePair <TKey, IFrameAssignableCellView> Entry in this)
            {
                if (!comparer.IsTrue(AsOtherReadOnlyDictionary.ContainsKey(Entry.Key)))
                {
                    return(comparer.Failed());
                }

                IFrameAssignableCellView ThisValue  = Entry.Value;
                IFrameAssignableCellView OtherValue = AsOtherReadOnlyDictionary[Entry.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(Entry.Value, AsOtherReadOnlyDictionary[Entry.Key]))
                    {
                        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 LayoutAssignableCellViewReadOnlyDictionary <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());
                }

                ILayoutAssignableCellView ThisValue  = (ILayoutAssignableCellView)this[Key];
                ILayoutAssignableCellView OtherValue = (ILayoutAssignableCellView)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);
        }
Exemple #14
0
        /// <summary>
        /// Compares two <see cref="IReadOnlyBlockState"/> 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 ReadOnlyBlockState <IInner> AsBlockState))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(ParentInner, AsBlockState.ParentInner))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameReference(ChildBlock, AsBlockState.ChildBlock))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual((IEqualComparable)PatternIndex, (IEqualComparable)AsBlockState.PatternIndex))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(PatternState, AsBlockState.PatternState))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual((IEqualComparable)SourceIndex, (IEqualComparable)AsBlockState.SourceIndex))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(SourceState, AsBlockState.SourceState))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(StateList, AsBlockState.StateList))
            {
                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;
        }
        /// <inheritdoc/>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            Contract.RequireNotNull(other, out IEqualComparable Other);

            if (!comparer.IsSameType(Other, out LayoutFrameSelectorReadOnlyList AsOtherReadOnlyList))
            {
                return(comparer.Failed());
            }

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

            for (int i = 0; i < Count; i++)
            {
                if (!comparer.VerifyEqual(this[i], AsOtherReadOnlyList[i]))
                {
                    return(comparer.Failed());
                }
            }

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

            if (!comparer.IsSameType(Other, out FocusPlaceholderNodeStateList AsOtherList))
            {
                return(comparer.Failed());
            }

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

            for (int i = 0; i < Count; i++)
            {
                if (!comparer.VerifyEqual(this[i], AsOtherList[i]))
                {
                    return(comparer.Failed());
                }
            }

            return(true);
        }
Exemple #18
0
        /// <inheritdoc/>
        public override bool IsEqual(CompareEqual comparer, IEqualComparable other)
        {
            if (!comparer.IsSameType(other, out ReadOnlyPatternState <IInner> AsPatternState))
            {
                return(comparer.Failed());
            }

            if (!base.IsEqual(comparer, AsPatternState))
            {
                return(comparer.Failed());
            }

            if (!comparer.IsSameReference(Node, AsPatternState.Node))
            {
                return(comparer.Failed());
            }

            if (!comparer.VerifyEqual(ParentBlockState, AsPatternState.ParentBlockState))
            {
                return(comparer.Failed());
            }

            return(true);
        }
        /// <summary>
        /// Compares two <see cref="IWriteablePlaceholderNodeStateReadOnlyList"/> 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 WriteablePlaceholderNodeStateReadOnlyList AsPlaceholderNodeStateReadOnlyList))
            {
                return(comparer.Failed());
            }

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

            for (int i = 0; i < Count; i++)
            {
                if (!comparer.VerifyEqual(this[i], AsPlaceholderNodeStateReadOnlyList[i]))
                {
                    return(comparer.Failed());
                }
            }

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

            if (!comparer.IsSameType(Other, out FrameCellViewList AsOtherList))
            {
                return(comparer.Failed());
            }

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

            for (int i = 0; i < Count; i++)
            {
                if (!comparer.VerifyEqual(this[i], AsOtherList[i]))
                {
                    return(comparer.Failed());
                }
            }

            return(true);
        }
        /// <summary>
        /// Compares two <see cref="IFrameCellViewList"/> 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 FrameCellViewList AsCellViewList))
            {
                return(comparer.Failed());
            }

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

            for (int i = 0; i < Count; i++)
            {
                if (!comparer.VerifyEqual(this[i], AsCellViewList[i]))
                {
                    return(comparer.Failed());
                }
            }

            return(true);
        }