Ejemplo 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
            //------------------------------------------------------------
            AtomId value = obj as AtomId;

            if (value != null)
            {
                int result = Uri.Compare(this.Uri, value.Uri, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.Ordinal);

                result = result | AtomUtility.CompareCommonObjectAttributes(this, value);

                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");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomEntryResource"/> class using the supplied <see cref="AtomId"/>, <see cref="AtomTextConstruct"/>, and <see cref="DateTime"/>.
 /// </summary>
 /// <param name="id">A <see cref="AtomId"/> object that represents a permanent, universally unique identifier for this entry.</param>
 /// <param name="title">A <see cref="AtomTextConstruct"/> object that represents information that conveys a human-readable title for this entry.</param>
 /// <param name="updatedOn">
 ///     A <see cref="DateTime"/> that indicates the most recent instant in time when this entry was modified in a way the publisher considers significant. 
 ///     The <see cref="DateTime"/> should be provided in Coordinated Universal Time (UTC).
 /// </param>
 /// <exception cref="ArgumentNullException">The <paramref name="id"/> is a null reference (Nothing in Visual Basic).</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="title"/> is a null reference (Nothing in Visual Basic).</exception>
 public AtomEntryResource(AtomId id, AtomTextConstruct title, DateTime updatedOn)
     : base(id, title, updatedOn)
 {
     //------------------------------------------------------------
     //	Initialization handled by base class
     //------------------------------------------------------------
 }
        /// <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);
            }
            AtomId value = obj as AtomId;

            if (value != null)
            {
                int result = Uri.Compare(this.Uri, value.Uri, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.Ordinal);

                result = result | AtomUtility.CompareCommonObjectAttributes(this, value);

                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");
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomSource"/> class using the supplied <see cref="AtomId"/>, <see cref="AtomTextConstruct"/>, and <see cref="DateTime"/>.
 /// </summary>
 /// <param name="id">A <see cref="AtomId"/> object that represents a permanent, universally unique identifier for this source.</param>
 /// <param name="title">A <see cref="AtomTextConstruct"/> object that represents information that conveys a human-readable title for this source.</param>
 /// <param name="utcUpdatedOn">
 ///     A <see cref="DateTime"/> that indicates the most recent instant in time when this source was modified in a way the publisher considers significant. 
 ///     The <see cref="DateTime"/> should be provided in Coordinated Universal Time (UTC).
 /// </param>
 public AtomSource(AtomId id, AtomTextConstruct title, DateTime utcUpdatedOn)
 {
     //------------------------------------------------------------
     //	Initialize class state using properties
     //------------------------------------------------------------
     this.Id         = id;
     this.Title      = title;
     this.UpdatedOn  = utcUpdatedOn;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomSource"/> class using the supplied <see cref="AtomId"/>, <see cref="AtomTextConstruct"/>, and <see cref="DateTime"/>.
 /// </summary>
 /// <param name="id">A <see cref="AtomId"/> object that represents a permanent, universally unique identifier for this source.</param>
 /// <param name="title">A <see cref="AtomTextConstruct"/> object that represents information that conveys a human-readable title for this source.</param>
 /// <param name="utcUpdatedOn">
 ///     A <see cref="DateTime"/> that indicates the most recent instant in time when this source was modified in a way the publisher considers significant.
 ///     The <see cref="DateTime"/> should be provided in Coordinated Universal Time (UTC).
 /// </param>
 public AtomSource(AtomId id, AtomTextConstruct title, DateTime utcUpdatedOn)
 {
     this.Id        = id;
     this.Title     = title;
     this.UpdatedOn = utcUpdatedOn;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomEntryResource"/> class using the supplied <see cref="AtomId"/>, <see cref="AtomTextConstruct"/>, and <see cref="DateTime"/>.
 /// </summary>
 /// <param name="id">A <see cref="AtomId"/> object that represents a permanent, universally unique identifier for this entry.</param>
 /// <param name="title">A <see cref="AtomTextConstruct"/> object that represents information that conveys a human-readable title for this entry.</param>
 /// <param name="updatedOn">
 ///     A <see cref="DateTime"/> that indicates the most recent instant in time when this entry was modified in a way the publisher considers significant. 
 ///     The <see cref="DateTime"/> should be provided in Coordinated Universal Time (UTC).
 /// </param>
 /// <param name="editedOn">
 ///     A <see cref="DateTime"/> that indicates the most recent instant in time when this entry was edited. 
 ///     The <see cref="DateTime"/> should be provided in Coordinated Universal Time (UTC).
 /// </param>
 /// <param name="isDraft">A value indicating if client has requested to control the visibility of the entry.</param>
 /// <exception cref="ArgumentNullException">The <paramref name="id"/> is a null reference (Nothing in Visual Basic).</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="title"/> is a null reference (Nothing in Visual Basic).</exception>
 public AtomEntryResource(AtomId id, AtomTextConstruct title, DateTime updatedOn, DateTime editedOn, bool isDraft)
     : this(id, title, updatedOn, editedOn)
 {
     //------------------------------------------------------------
     //	Initialize class state using properties
     //------------------------------------------------------------
     this.IsDraft    = isDraft;
 }