Exemplo n.º 1
0
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            YahooMediaRestriction value = obj as YahooMediaRestriction;

            if (value != null)
            {
                int result = ComparisonUtility.CompareSequence(this.Entities, value.Entities, StringComparison.Ordinal);
                result = result | this.EntityType.CompareTo(value.EntityType);
                result = result | this.Relationship.CompareTo(value.Relationship);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Exemplo n.º 2
0
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            SiteSummarySlashSyndicationExtension value = obj as SiteSummarySlashSyndicationExtension;

            if (value != null)
            {
                int result = this.Context.Comments.CompareTo(value.Context.Comments);
                result = result | String.Compare(this.Context.Department, value.Context.Department, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Context.Section, value.Context.Section, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Context.HitParade, value.Context.HitParade);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Exemplo n.º 3
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            var syndicationExtension = obj as TagsSyndicationExtension;

            if (syndicationExtension != null)
            {
                return
                    (string.Compare(Description, syndicationExtension.Description, StringComparison.OrdinalIgnoreCase) |
                     Uri.Compare(Documentation, syndicationExtension.Documentation, UriComponents.AbsoluteUri,
                                 UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) |
                     string.Compare(Name, syndicationExtension.Name, StringComparison.OrdinalIgnoreCase) |
                     Version.CompareTo(syndicationExtension.Version) |
                     string.Compare(XmlNamespace, syndicationExtension.XmlNamespace, StringComparison.Ordinal) |
                     string.Compare(XmlPrefix, syndicationExtension.XmlPrefix, StringComparison.Ordinal) |
                     ComparisonUtility.CompareSequence(Context.Tags, syndicationExtension.Context.Tags,
                                                       StringComparison.OrdinalIgnoreCase));
            }
            throw new ArgumentException(
                      string.Format(null, "obj is not of type {0}, type was found to be '{1}'.", (object)GetType().FullName,
                                    (object)obj.GetType().FullName), nameof(obj));
        }
Exemplo n.º 4
0
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            FeedSynchronizationItem value = obj as FeedSynchronizationItem;

            if (value != null)
            {
                int result = String.Compare(this.Id, value.Id, StringComparison.OrdinalIgnoreCase);
                result = result | this.ConflictPreservation.CompareTo(value.ConflictPreservation);
                result = result | this.TombstoneStatus.CompareTo(value.TombstoneStatus);
                result = result | this.Updates.CompareTo(value.Updates);
                result = result | FeedSynchronizationItem.CompareSequence(this.Histories, value.Histories);
                result = result | ComparisonUtility.CompareSequence(this.Conflicts, value.Conflicts);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            PingbackSyndicationExtension value = obj as PingbackSyndicationExtension;

            if (value != null)
            {
                int result = Uri.Compare(this.Context.Server, value.Context.Server, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | Uri.Compare(this.Context.Target, value.Context.Target, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Context.Abouts, value.Context.Abouts, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            OpmlOutline value = obj as OpmlOutline;

            if (value != null)
            {
                int result = String.Compare(this.ContentType, value.ContentType, StringComparison.OrdinalIgnoreCase);
                result = result | this.CreatedOn.CompareTo(value.CreatedOn);
                result = result | this.HasBreakpoint.CompareTo(value.HasBreakpoint);
                result = result | this.IsCommented.CompareTo(value.IsCommented);
                result = result | String.Compare(this.Text, value.Text, StringComparison.OrdinalIgnoreCase);

                result = result | ComparisonUtility.CompareSequence(this.Attributes, value.Attributes, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Categories, value.Categories, StringComparison.OrdinalIgnoreCase);
                result = result | OpmlOutline.CompareSequence(this.Outlines, value.Outlines);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            CreativeCommonsSyndicationExtension value = obj as CreativeCommonsSyndicationExtension;

            if (value != null)
            {
                int result = String.Compare(this.Description, value.Description, StringComparison.OrdinalIgnoreCase);
                result = result | Uri.Compare(this.Documentation, value.Documentation, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Name, value.Name, StringComparison.OrdinalIgnoreCase);
                result = result | this.Version.CompareTo(value.Version);
                result = result | String.Compare(this.XmlNamespace, value.XmlNamespace, StringComparison.Ordinal);
                result = result | String.Compare(this.XmlPrefix, value.XmlPrefix, StringComparison.Ordinal);

                result = result | ComparisonUtility.CompareSequence(this.Context.Licenses, value.Context.Licenses, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Exemplo n.º 8
0
        //============================================================
        //	ICOMPARABLE IMPLEMENTATION
        //============================================================
        #region CompareTo(object obj)
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            //------------------------------------------------------------
            //	If target is a null reference, instance is greater
            //------------------------------------------------------------
            if (obj == null)
            {
                return(1);
            }

            //------------------------------------------------------------
            //	Determine comparison result using property state of objects
            //------------------------------------------------------------
            RsdApplicationInterface value = obj as RsdApplicationInterface;

            if (value != null)
            {
                int result = Uri.Compare(this.Documentation, value.Documentation, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | this.IsPreferred.CompareTo(value.IsPreferred);
                result = result | Uri.Compare(this.Link, value.Link, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Name, value.Name, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Notes, value.Notes, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Settings, value.Settings, StringComparison.Ordinal);
                result = result | String.Compare(this.WeblogId, value.WeblogId, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Compares the collections for objects that implement the <see cref="IYahooMediaCommonObjectEntities"/> interface.
        /// </summary>
        /// <param name="source">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> interface to be compared.</param>
        /// <param name="target">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> to compare with the <paramref name="source"/>.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        private static int CompareCommonObjectEntityCollections(IYahooMediaCommonObjectEntities source, IYahooMediaCommonObjectEntities target)
        {
            int result = 0;

            if (source == null && target == null)
            {
                return(0);
            }
            else if (source != null && target == null)
            {
                return(1);
            }
            else if (source == null && target != null)
            {
                return(-1);
            }
            result = result | YahooMediaUtility.CompareSequence(source.Categories, target.Categories);
            result = result | YahooMediaUtility.CompareSequence(source.Credits, target.Credits);
            result = result | YahooMediaUtility.CompareSequence(source.Hashes, target.Hashes);
            result = result | ComparisonUtility.CompareSequence(source.Keywords, target.Keywords, StringComparison.OrdinalIgnoreCase);
            result = result | YahooMediaUtility.CompareSequence(source.Ratings, target.Ratings);
            result = result | YahooMediaUtility.CompareSequence(source.Restrictions, target.Restrictions);
            result = result | YahooMediaUtility.CompareSequence(source.TextSeries, target.TextSeries);
            result = result | YahooMediaUtility.CompareSequence(source.Thumbnails, target.Thumbnails);

            return(result);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            ITunesSyndicationExtension value = obj as ITunesSyndicationExtension;

            if (value != null)
            {
                int result = String.Compare(this.Context.Author, value.Context.Author, StringComparison.OrdinalIgnoreCase);
                result = result | ITunesSyndicationExtension.CompareSequence(this.Context.Categories, value.Context.Categories);
                result = result | this.Context.Duration.CompareTo(value.Context.Duration);
                result = result | this.Context.ExplicitMaterial.CompareTo(value.Context.ExplicitMaterial);
                result = result | Uri.Compare(this.Context.Image, value.Context.Image, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase);
                result = result | this.Context.IsBlocked.CompareTo(value.Context.IsBlocked);
                result = result | ComparisonUtility.CompareSequence(this.Context.Keywords, value.Context.Keywords, StringComparison.OrdinalIgnoreCase);
                result = result | Uri.Compare(this.Context.NewFeedUrl, value.Context.NewFeedUrl, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase);
                result = result | this.Context.Owner.CompareTo(value.Context.Owner);
                result = result | String.Compare(this.Context.Subtitle, value.Context.Subtitle, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Context.Summary, value.Context.Summary, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            TrackbackSyndicationExtension value = obj as TrackbackSyndicationExtension;

            if (value != null)
            {
                int result = Uri.Compare(this.Context.Ping, value.Context.Ping, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Context.Abouts, value.Context.Abouts, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            YahooMediaRestriction value = obj as YahooMediaRestriction;

            if (value != null)
            {
                int result = ComparisonUtility.CompareSequence(this.Entities, value.Entities, StringComparison.Ordinal);
                result = result | this.EntityType.CompareTo(value.EntityType);
                result = result | this.Relationship.CompareTo(value.Relationship);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            SiteSummarySlashSyndicationExtension value = obj as SiteSummarySlashSyndicationExtension;

            if (value != null)
            {
                int result = this.Context.Comments.CompareTo(value.Context.Comments);
                result = result | String.Compare(this.Context.Department, value.Context.Department, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Context.Section, value.Context.Section, StringComparison.OrdinalIgnoreCase);
                result = result | ComparisonUtility.CompareSequence(this.Context.HitParade, value.Context.HitParade);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }