/// <summary>
 /// Checks if specified range is equal
 /// </summary>
 /// <param name="aInfo">
 /// Range to be checked <see cref="IRangeClippingInformation"/>
 /// </param>
 /// <returns>
 /// true if equal, false if not <see cref="System.Boolean"/>
 /// </returns>
 public bool IsEqual(IRangeClippingInformation aInfo)
 {
     if (aInfo == null)
     {
         return(false);
     }
     return(IsEqual(aInfo.From, aInfo.To));
 }
 /// <summary>
 /// Returns if this clipping information contains specified index
 /// </summary>
 /// <param name="aInfo">
 /// Clipping information to be checked with <see cref="IRangeClippingInformation"/>
 /// </param>
 /// <returns>
 /// true if clipping information is vaid and index is inside From To range <see cref="System.Boolean"/>
 /// </returns>
 public bool IntersectsWith(IRangeClippingInformation aInfo)
 {
     if (aInfo == null)
     {
         return(false);
     }
     return(IntersectsWith(aInfo.From, aInfo.To));
 }
 /// <summary>
 /// Returns if this clipping information contains specified index
 /// </summary>
 /// <param name="aInfo">
 /// Clipping information to be checked with <see cref="IRangeClippingInformation"/>
 /// </param>
 /// <returns>
 /// true if clipping information is valid and region is inside From To range <see cref="System.Boolean"/>
 /// </returns>
 public bool Contains(IRangeClippingInformation aInfo)
 {
     if (aInfo == null)
     {
         return(false);
     }
     return(Contains(aInfo.From, aInfo.To));
 }
 /// <summary>
 /// Removes region from this buffer if they can be connected into one
 /// </summary>
 /// <param name="aInfo">
 /// Clipping buffer to add <see cref="IRangeClippingInformation"/>
 /// </param>
 /// <param name="aNewBuffer">
 /// Buffer being created when this one split in two <see cref="IRangeClippingInformation"/>
 /// </param>
 /// <returns>
 /// true if clipping region can be connected, false if not <see cref="System.Boolean"/>
 /// </returns>
 public bool Remove(IRangeClippingInformation aInfo, out IRangeClippingInformation aNewBuffer)
 {
     aNewBuffer = null;
     if (aInfo == null)
     {
         return(false);
     }
     return(Remove(aInfo.From, aInfo.To, out aNewBuffer));
 }
 /// <summary>
 /// Removes region from this buffer if they can be connected into one
 /// </summary>
 /// <param name="aFrom">
 /// Min clip parameter <see cref="System.Int32"/>
 /// </param>
 /// <param name="aTo">
 /// Max clip parameter <see cref="System.Int32"/>
 /// </param>
 /// <param name="aNewBuffer">
 /// Buffer being created when this one split in two <see cref="IRangeClippingInformation"/>
 /// </param>
 /// <returns>
 /// true if clipping region can be connected, false if not <see cref="System.Boolean"/>
 /// </returns>
 public bool Remove(int aFrom, int aTo, out IRangeClippingInformation aNewBuffer)
 {
     aNewBuffer = null;
     if (IsRangeValid(aFrom, aTo) == false)
     {
         return(false);
     }
     if (IsEqual(aFrom, aTo) == true)
     {
         from = 0;
         to   = -1;
         Changed();
         return(true);
     }
     if (IntersectsWith(aFrom, aTo) == false)
     {
         return(false);
     }
     if (Contains(aFrom, aTo) == true)
     {
         // split this range into two
         int t = To;
         to         = aTo - 1;
         aNewBuffer = new BufferClippingInformation(aTo + 1, t);
         if (aNewBuffer.IsValid == false)
         {
             aNewBuffer = null;
         }
         Changed();
         return(true);
     }
     if (aFrom < From)
     {
         from = aTo + 1;
     }
     else
     {
         to = aFrom - 1;
     }
     return(true);
 }