Ejemplo n.º 1
0
 /// <summary>
 /// Merges two ranges into one range that fully encompasses both ranges.
 /// </summary>
 /// <param name="range">The range to be merged with this one.</param>
 /// <returns>The range that fully encompasses the merged ranges.</returns>
 public Range <T> Merge(Range <T> range)
 {
     return(Merge(range, Comparer <T> .Default));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Merges two ranges into one range that fully encompasses both ranges.
 /// </summary>
 /// <param name="range">The range to be merged with this one.</param>
 /// <param name="comparer">The comparer used to compare objects of type <typeparamref name="T"/>.</param>
 /// <returns>The range that fully encompasses the merged ranges.</returns>
 public Range <T> Merge(Range <T> range, IComparer <T> comparer)
 {
     return(Merge(range, comparer.Compare));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Determines whether the range overlaps with the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <param name="comparer">The comparer used to compare objects of type <typeparamref name="T"/>.</param>
 /// <returns>True if the ranges overlap; false otherwise.</returns>
 public bool Overlaps(Range <T> range, IComparer <T> comparer)
 {
     return(Overlaps(range, comparer.Compare));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Determines whether the range overlaps with the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <param name="comparison">The comparison used to compare objects of type <typeparamref name="T"/>.</param>
 /// <returns>True if the ranges overlap; false otherwise.</returns>
 public bool Overlaps(Range <T> range, Comparison <T> comparison)
 {
     return(comparison(Start, range.End) <= 0 && comparison(range.Start, End) <= 0);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Determines whether the range overlaps with the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <returns>True if the ranges overlap; false otherwise.</returns>
 public bool Overlaps(Range <T> range)
 {
     return(Overlaps(range, Comparer <T> .Default));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Determines whether the range contains the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <param name="comparison">The comparison used to compare objects of type <typeparamref name="T"/>.</param>
 /// <returns>True if the given range exists within this range; false otherwise.</returns>
 public bool Contains(Range <T> range, Comparison <T> comparison)
 {
     return(comparison(Start, range.Start) <= 0 && comparison(range.End, End) <= 0);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Determines whether the range contains the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <param name="comparer">The comparer used to compare objects of type <typeparamref name="T"/>.</param>
 /// <returns>True if the given range exists within this range; false otherwise.</returns>
 public bool Contains(Range <T> range, IComparer <T> comparer)
 {
     return(Contains(range, comparer.Compare));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Determines whether the range contains the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <returns>True if the given range exists within this range; false otherwise.</returns>
 public bool Contains(Range <T> range)
 {
     return(Contains(range, Comparer <T> .Default));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Determines whether the range overlaps with the given range.
 /// </summary>
 /// <param name="range">The range to be compared with.</param>
 /// <param name="comparison">The comparison used to compare objects of type <typeparamref name="T"/>.</param>
 /// <returns>True if the ranges overlap; false otherwise.</returns>
 public bool Overlaps(Range <T> range, Comparison <T> comparison)
 {
     return(comparison(m_start, range.m_end) <= 0 && comparison(range.m_start, m_end) <= 0);
 }