Browse Source

Add CompressingTreeList.GetRunLength method.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6074 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 15 years ago
parent
commit
33d038d624
  1. 11
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CompressingTreeList.cs

11
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CompressingTreeList.cs

@ -343,9 +343,20 @@ namespace ICSharpCode.AvalonEdit.Utils @@ -343,9 +343,20 @@ namespace ICSharpCode.AvalonEdit.Utils
n = n.Successor;
}
}
Debug.Assert(index == this.Count);
return -1;
}
/// <summary>
/// Gets the number of elements after <paramref name="index"/> that have the same value as each other.
/// </summary>
public int GetRunLength(int index)
{
if (index < 0 || index >= this.Count)
throw new ArgumentOutOfRangeException("index", index, "Value must be between 0 and " + (this.Count - 1));
return GetNode(ref index).count - index;
}
/// <summary>
/// Inserts the specified <paramref name="item"/> at <paramref name="index"/>
/// </summary>

Loading…
Cancel
Save