예제 #1
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     return(TimeSpan1.GetHashCode() ^
            TimeSpan2.GetHashCode() ^
            Operation.GetHashCode() ^
            Mode.GetHashCode());
 }
예제 #2
0
        /// <summary>
        /// Shrinks the current time span by dividing its length by the specified divisor.
        /// </summary>
        /// <param name="divisor">Divisor to shrink the time span by.</param>
        /// <returns>Time span that is the current time span shrinked by the <paramref name="divisor"/>.</returns>
        public ITimeSpan Divide(double divisor)
        {
            ThrowIfArgument.IsNegative(nameof(divisor), divisor, "Divisor is negative.");

            return(new MathTimeSpan(TimeSpan1.Divide(divisor),
                                    TimeSpan2.Divide(divisor),
                                    Operation,
                                    Mode));
        }
예제 #3
0
        /// <summary>
        /// Stretches the current time span by multiplying its length by the specified multiplier.
        /// </summary>
        /// <param name="multiplier">Multiplier to stretch the time span by.</param>
        /// <returns>Time span that is the current time span stretched by the <paramref name="multiplier"/>.</returns>
        public ITimeSpan Multiply(double multiplier)
        {
            ThrowIfArgument.IsNegative(nameof(multiplier), multiplier, "Multiplier is negative.");

            return(new MathTimeSpan(TimeSpan1.Multiply(multiplier),
                                    TimeSpan2.Multiply(multiplier),
                                    Operation,
                                    Mode));
        }
예제 #4
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var result = 17;
         result = result * 23 + TimeSpan1.GetHashCode();
         result = result * 23 + TimeSpan2.GetHashCode();
         result = result * 23 + Operation.GetHashCode();
         result = result * 23 + Mode.GetHashCode();
         return(result);
     }
 }
예제 #5
0
 /// <summary>
 /// Clones the current time span.
 /// </summary>
 /// <returns>Copy of the current time span.</returns>
 public ITimeSpan Clone()
 {
     return(new MathTimeSpan(TimeSpan1.Clone(), TimeSpan2.Clone(), Operation, Mode));
 }