lastBlockCount is called lastBlockEndIndex again (anyone got a better term - it's an index one past the last entry, not a count); implemented the CopyTo() method; added unit tests for the CopyTo() method

git-svn-id: file:///srv/devel/repo-conversion/nusu@164 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2009-07-14 21:08:10 +00:00
parent 3ee5fdfc67
commit 0b23b1f7c4
6 changed files with 120 additions and 31 deletions

View file

@ -13,7 +13,7 @@ namespace Nuclex.Support.Collections {
/// <returns>The index of the item or -1 if it wasn't found</returns>
public int IndexOf(ItemType item) {
if(this.blocks.Count == 1) { // Only one block to scan?
int length = this.lastBlockCount - this.firstBlockStartIndex;
int length = this.lastBlockEndIndex - this.firstBlockStartIndex;
int index = Array.IndexOf<ItemType>(
this.blocks[0], item, this.firstBlockStartIndex, length
);
@ -50,7 +50,7 @@ namespace Nuclex.Support.Collections {
// Nothing found, continue the search in the
index = Array.IndexOf<ItemType>(
this.blocks[lastBlock], item, 0, this.lastBlockCount
this.blocks[lastBlock], item, 0, this.lastBlockEndIndex
);
if(index == -1) {
return -1;