/// <summary>
 ///     Clamps the given instance to a value in the range specified.
 /// </summary>
 /// <param name="value">
 ///     The value to clamp.
 /// </param>
 /// <param name="extreme1">
 ///     One of the extremes of the range.
 /// </param>
 /// <param name="extreme2">
 ///     The other extreme of the range.
 /// </param>
 /// <returns>
 ///     The value clamped to an acceptable value within the specified range.
 /// </returns>
 public static TimestampDelta SafeClamp(TimestampDelta value, TimestampDelta extreme1, TimestampDelta extreme2)
 {
     return(new TimestampDelta(Int64Utils.SafeClamp(value.ToNanoseconds, extreme1.ToNanoseconds, extreme2.ToNanoseconds)));
 }
 /// <summary>
 ///     Clamps the given instance to a value in the range specified.
 /// </summary>
 /// <param name="value">
 ///     The value to clamp.
 /// </param>
 /// <param name="min">
 ///     The minimum allowable value.
 /// </param>
 /// <param name="max">
 ///     The maximum allowable value.
 /// </param>
 /// <returns>
 ///     The value clamped to an acceptable value within the specified range.
 /// </returns>
 /// <exception cref="System.ArgumentOutOfRangeException">
 ///     <paramref name="max"/> is less than <paramref name="min"/>.
 /// </exception>
 public static TimestampDelta Clamp(TimestampDelta value, TimestampDelta min, TimestampDelta max)
 {
     return(new TimestampDelta(Int64Utils.Clamp(value.ToNanoseconds, min.ToNanoseconds, max.ToNanoseconds)));
 }
Example #3
0
 /// <summary>
 ///     Determines whether the given value has been clamped into the
 ///     specified range.
 /// </summary>
 /// <param name="value">
 ///     The value to check.
 /// </param>
 /// <param name="extreme1">
 ///     One extreme of the clamp.
 /// </param>
 /// <param name="extreme2">
 ///     The other extreme of the clamp.
 /// </param>
 /// <returns>
 ///     <c>true</c> if the value has been clamped; <c>false</c> otherwise.
 /// </returns>
 public static bool SafeIsClamped(Timestamp value, Timestamp extreme1, Timestamp extreme2)
 {
     return(Int64Utils.SafeIsClamped(value.ToNanoseconds, extreme1.ToNanoseconds, extreme2.ToNanoseconds));
 }
Example #4
0
 /// <summary>
 ///     Determines whether the given value has been clamped into the
 ///     specified range.
 /// </summary>
 /// <param name="value">
 ///     The value to check.
 /// </param>
 /// <param name="min">
 ///     The minimum value of the clamp.
 /// </param>
 /// <param name="max">
 ///     The maximum value of the clamp.
 /// </param>
 /// <returns>
 ///     <c>true</c> if the value has been clamped; <c>false</c> otherwise.
 /// </returns>
 public static bool IsClamped(Timestamp value, Timestamp min, Timestamp max)
 {
     return(Int64Utils.IsClamped(value.ToNanoseconds, min.ToNanoseconds, max.ToNanoseconds));
 }
Example #5
0
 /// <summary>
 ///     Determines whether this range overlaps with the given range.
 ///     See <see cref="Int64Utils.DoRangesOverlap"/> for more information.
 /// </summary>
 /// <param name="other">
 ///     The range to check.
 /// </param>
 /// <returns>
 ///     <c>true</c> if this instance overlaps with <paramref name="other"/>;
 ///     <c>false</c> otherwise.
 /// </returns>
 public bool Overlaps(Int64Range other)
 {
     return(Int64Utils.DoRangesOverlap(this.begin, this.end, other.begin, other.end));
 }
Example #6
0
 // Does [this.startTime, this.endTime] intersect with [other.startTime, other.endTime]
 /// <summary>
 ///     Determines whether this instance intersects inclusively with
 ///     the given instance.
 ///     <para/>
 ///     Does [this.startTime, this.endTime] intersect with [other.startTime, other.endTime]
 /// </summary>
 /// <param name="other">
 ///     The range to check against.
 /// </param>
 /// <returns>
 ///     <c>true</c> if the ranges intersect; <c>false</c> otherwise.
 /// </returns>
 public bool IntersectsInclusivelyWith(TimeRange other)
 {
     return(Int64Utils.DoInclusiveRangesOverlap(this.startTime.ToNanoseconds, this.endTime.ToNanoseconds, other.startTime.ToNanoseconds, other.endTime.ToNanoseconds));
 }