/// <summary>
        /// Indicates whether the essence of this orphan's identity is equal to another orphan's identity.
        /// </summary>
        /// <param name="other">The orphan to compare with.</param>
        /// <returns>True if the other orphan's identity is equal to this object. Otherwise, false.</returns>
        internal override bool EqualsIdentity(PrtgOrphan other)
        {
            if (other == null)
            {
                return(false);
            }

            if (GetType() != other.GetType())
            {
                return(false);
            }

            var property = (PropertyValuePair)other.Value;

            if (property.Property.IsLeft)
            {
                if (Value.Property.IsLeft)
                {
                    return(property.Property.Left == Value.Property.Left);
                }

                return(false);
            }
            else
            {
                if (Value.Property.IsLeft)
                {
                    return(false);
                }

                return(property.Property.Right == Value.Property.Right);
            }
        }
Exemple #2
0
 private void DefaultVisit(PrtgOrphan orphan)
 {
     foreach (var child in orphan.Children)
     {
         Visit(child);
     }
 }
Exemple #3
0
        /// <summary>
        /// Visits a single <see cref="PrtgOrphan"/> and produces a value of type <typeparamref name="TResult"/>.
        /// </summary>
        /// <param name="orphan">The orphan to visit.</param>
        /// <returns>If the orphan was not null, the value produced by visiting it. Otherwise, the default value of <typeparamref name="TResult"/>.</returns>
        internal virtual TResult Visit(PrtgOrphan orphan)
        {
            if (orphan != null)
            {
                return(orphan.Accept(this));
            }

            return(default(TResult));
        }
Exemple #4
0
        internal static IEnumerable <TOrphan> FindOrphans <TOrphan>(this PrtgOrphan root, Func <TOrphan, bool> predicate = null)
            where TOrphan : PrtgOrphan
        {
            if (predicate == null)
            {
                predicate = v => true;
            }

            return(root?.DescendantOrphans().OfType <TOrphan>().Where(predicate));
        }
Exemple #5
0
        /// <summary>
        /// Indicates whether the essence of this orphan's identity is equal to another orphan's identity.
        /// </summary>
        /// <param name="other">The orphan to compare with.</param>
        /// <returns>True if the other orphan's identity is equal to this object. Otherwise, false.</returns>
        internal override bool EqualsIdentity(PrtgOrphan other)
        {
            if (other == null)
            {
                return(false);
            }

            if (GetType() != other.GetType())
            {
                return(false);
            }

            return(Value.Id == other.Value.Id);
        }
Exemple #6
0
        /// <summary>
        /// Indicates whether the essence of this orphan's identity is equal to another orphan's identity.
        /// </summary>
        /// <param name="other">The orphan to compare with.</param>
        /// <returns>True if the other orphan's identity is equal to this object. Otherwise, false.</returns>
        internal override bool EqualsIdentity(PrtgOrphan other)
        {
            if (other == null)
            {
                return(false);
            }

            if (GetType() != other.GetType())
            {
                return(false);
            }

            return(base.EqualsIdentity(other));
        }
 /// <summary>
 /// The action to perform for all orphans whose visitor method is not overridden.
 /// </summary>
 /// <param name="orphan">The orphan to visit.</param>
 /// <returns>The result of visiting the orphan.</returns>
 protected abstract TResult DefaultVisit(PrtgOrphan orphan);
 /// <summary>
 /// The action to perform for all orphans whose visitor method is not overridden.
 /// </summary>
 /// <param name="orphan">The orphan to visit.</param>
 protected abstract void DefaultVisit(PrtgOrphan orphan);
Exemple #9
0
 internal static TOrphan FindOrphan <TOrphan>(this PrtgOrphan root, Func <TOrphan, bool> predicate = null) where TOrphan : PrtgOrphan =>
 FindOrphans(root, predicate)?.SingleOrDefault();
Exemple #10
0
 internal static IEnumerable <PrtgOrphan> FindOrphans(this PrtgOrphan root, Func <PrtgOrphan, bool> predicate) =>
 FindOrphans <PrtgOrphan>(root, predicate);
Exemple #11
0
 internal static PrtgOrphan FindOrphan(this PrtgOrphan root, Func <PrtgOrphan, bool> predicate) =>
 FindOrphan <PrtgOrphan>(root, predicate);
Exemple #12
0
 /// <summary>
 /// Visits a single <see cref="PrtgOrphan"/>.
 /// </summary>
 /// <param name="orphan">The orphan to visit.</param>
 public virtual void Visit(PrtgOrphan orphan) => orphan.Accept(this);
 public PrtgOrphanDebugView(PrtgOrphan <TValue> orphan)
 {
     this.orphan = orphan;
 }