Exemple #1
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other, bool inclusiveEnd)
 {
     if (inclusiveEnd)
     {
         return(ContainsInclusiveEnd(range, other));
     }
     return(range.Contains(other.Start) && range.Contains(other.End));
 }
Exemple #2
0
        public override IReadOnlyList <T> ItemsInRange(ITextRange range)
        {
            IReadOnlyList <T> list = base.ItemsInRange(range);

            if (Count > 0)
            {
                IHtmlToken lastItem = this[Count - 1] as IHtmlToken;
                if (lastItem != null && !lastItem.IsWellFormed)
                {
                    if (range.Contains(lastItem.End))
                    {
                        // Underlying method returs static readonly collection if nothing was found
                        // in the range so we need to create a new collection here.
                        List <T> modifiedList = new List <T>(list.Count + 1);
                        modifiedList.AddRange(list);
                        modifiedList.Add(this[Count - 1]);

                        list = modifiedList;
                    }
                }
            }

            return(list);
        }
Exemple #3
0
 /// <summary>
 /// Determines if range contains another range or it contains start point
 /// of the other range and their end points are the same.
 /// </summary>
 public static bool ContainsInclusiveEnd(ITextRange range, ITextRange other)
 {
     return(range.Contains(other.Start) && (range.Contains(other.End) || range.End == other.End));
 }
Exemple #4
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other)
 {
     return(range.Contains(other.Start) && range.Contains(other.End));
 }
Exemple #5
0
 public bool Contains(int position)
 {
     return(_range.Contains(position));
 }
Exemple #6
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other) => range.Contains(other.Start) && range.Contains(other.End);
Exemple #7
0
 /// <summary>
 /// Determines if range contains another range or it contains start point
 /// of the other range and their end points are the same.
 /// </summary>
 public static bool ContainsInclusiveEnd(ITextRange range, ITextRange other) {
     return range.Contains(other.Start) && (range.Contains(other.End) || range.End == other.End);
 }
Exemple #8
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other, bool inclusiveEnd) {
     if (inclusiveEnd)
         return ContainsInclusiveEnd(range, other);
     else
         return range.Contains(other.Start) && range.Contains(other.End);
 }
Exemple #9
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other) {
     return range.Contains(other.Start) && range.Contains(other.End);
 }