Inheritance: Temporal, IComparable
Example #1
0
 /// <summary>
 /// Compares two <see cref="Time"/> instances to determine if the
 /// first is equal to or smaller than the second.
 /// </summary>
 /// <param name="lhs">The first Time.</param>
 /// <param name="rhs">The second Tie.</param>
 /// <returns><c>true</c> if the first value is less than the second.</returns>
 public static bool LessOrEqual(Time lhs, Time rhs)
 {
     return (lhs.CompareTo (rhs) <= 0);
 }
Example #2
0
 /// <summary>
 /// Determines if two <see cref="Time"/> values are different.
 /// </summary>
 /// <param name="lhs">The <see cref="Time"/> to compare.</param>
 /// <param name="rhs">The <see cref="Time"/> to compare to.</param>
 /// <returns><c>true</c> if the two <see cref="Time"/> values are different.</returns>
 public static bool NotEqual(Time lhs, Time rhs)
 {
     return (!lhs.Equals (rhs));
 }
Example #3
0
 /// <summary>
 /// Determines if the value of a <see cref="Time"/> is less than
 /// the value of another.
 /// </summary>
 /// <param name="lhs">The <see cref="Time"/> to compare.</param>
 /// <param name="rhs">The <see cref="Time"/> to compare with.</param>
 /// <returns><c>true</c> if the first value is less than the second.</returns>
 public static bool Less(Time lhs, Time rhs)
 {
     return (lhs.CompareTo (rhs) < 0);
 }
Example #4
0
 /// <summary>
 /// Compares two <see cref="Time"/> instances to determine if the
 /// first is equal to or larger than the second.
 /// </summary>
 /// <param name="lhs">The first Time.</param>
 /// <param name="rhs">The second Time.</param>
 /// <returns><c>true</c> if the first value is greater than the second.</returns>
 public static bool GreaterOrEqual(Time lhs, Time rhs)
 {
     return (lhs.CompareTo (rhs) >= 0);
 }
Example #5
0
 /// <summary>
 /// Determines if the value of a <see cref="Time"/> is greater than
 /// the value of another.
 /// </summary>
 /// <param name="lhs">The <see cref="Time"/> to compare.</param>
 /// <param name="rhs">The <see cref="Time"/> to compare with.</param>
 /// <returns><c>true</c> if the first value is greater than the second.</returns>
 public static bool Greater(Time lhs, Time rhs)
 {
     return (lhs.CompareTo (rhs) > 0);
 }
Example #6
0
 /// <summary>
 /// Determines if the <b>Time</b> instance and another hold the same value.
 /// </summary>
 /// <param name="other">The <see cref="Time"/> to compare with.</param>
 /// <returns><b>true</b> if both instances are times and represent the
 ///	same value, <b>false</b> otherwise.</returns>
 public bool Equals(Time other)
 {
     if ((timeZone == null) && (other.timeZone == null))
         return (timeValue.Equals (other.timeValue));
     else if ((timeZone != null) && (other.timeZone != null) && timeZone.Equals (other.timeZone))
         return (timeValue.Equals (other.timeValue));
     else
         return (ToDateTime ().Equals (other.ToDateTime ()));
 }
Example #7
0
 /// <summary>
 /// Returns the result of comparing this instance to another <b>Time</b>
 /// instance.
 /// </summary>
 /// <param name="other">The other <b>Time</b> instance to compare with.</param>
 /// <returns>An integer value indicating the relative ordering.</returns>
 public int CompareTo(Time other)
 {
     if ((timeZone == null) && (other.timeZone == null))
         return (timeValue.CompareTo (other.timeValue));
     else if ((timeZone != null) && (other.timeZone != null) && timeZone.Equals (other.timeZone))
         return (timeValue.CompareTo (other.timeValue));
     else
         return (ToDateTime ().CompareTo (other.ToDateTime ()));
 }