All unit test classes are now internal; updated copyright statement for the year 2012; added hulls for the upcoming ObservableSet<> and ReadOnlySet<> classes; switched generic parameter naming convention TSomething instead of SomethingType
git-svn-id: file:///srv/devel/repo-conversion/nusu@252 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
61c858cb1c
commit
75552b5150
126 changed files with 922 additions and 463 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#region CPL License
|
||||
/*
|
||||
Nuclex Framework
|
||||
Copyright (C) 2002-2010 Nuclex Development Labs
|
||||
Copyright (C) 2002-2012 Nuclex Development Labs
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the IBM Common Public License as
|
||||
|
|
@ -24,15 +24,15 @@ using System.Collections;
|
|||
|
||||
namespace Nuclex.Support.Collections {
|
||||
|
||||
partial class Deque<ItemType> {
|
||||
partial class Deque<TItem> {
|
||||
|
||||
/// <summary>Inserts an item at the beginning of the double-ended queue</summary>
|
||||
/// <param name="item">Item that will be inserted into the queue</param>
|
||||
public void AddFirst(ItemType item) {
|
||||
public void AddFirst(TItem item) {
|
||||
if(this.firstBlockStartIndex > 0) {
|
||||
--this.firstBlockStartIndex;
|
||||
} else { // Need to allocate a new block
|
||||
this.blocks.Insert(0, new ItemType[this.blockSize]);
|
||||
this.blocks.Insert(0, new TItem[this.blockSize]);
|
||||
this.firstBlockStartIndex = this.blockSize - 1;
|
||||
}
|
||||
|
||||
|
|
@ -45,11 +45,11 @@ namespace Nuclex.Support.Collections {
|
|||
|
||||
/// <summary>Appends an item to the end of the double-ended queue</summary>
|
||||
/// <param name="item">Item that will be appended to the queue</param>
|
||||
public void AddLast(ItemType item) {
|
||||
public void AddLast(TItem item) {
|
||||
if(this.lastBlockEndIndex < this.blockSize) {
|
||||
++this.lastBlockEndIndex;
|
||||
} else { // Need to allocate a new block
|
||||
this.blocks.Add(new ItemType[this.blockSize]);
|
||||
this.blocks.Add(new TItem[this.blockSize]);
|
||||
this.lastBlockEndIndex = 1;
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ namespace Nuclex.Support.Collections {
|
|||
/// <summary>Inserts the item at the specified index</summary>
|
||||
/// <param name="index">Index the item will be inserted at</param>
|
||||
/// <param name="item">Item that will be inserted</param>
|
||||
public void Insert(int index, ItemType item) {
|
||||
public void Insert(int index, TItem item) {
|
||||
int distanceToRightEnd = this.count - index;
|
||||
if(index < distanceToRightEnd) { // Are we closer to the left end?
|
||||
shiftLeftAndInsert(index, item);
|
||||
|
|
@ -81,7 +81,7 @@ namespace Nuclex.Support.Collections {
|
|||
/// </summary>
|
||||
/// <param name="index">Index the item will be inserted at</param>
|
||||
/// <param name="item">Item that will be inserted</param>
|
||||
private void shiftLeftAndInsert(int index, ItemType item) {
|
||||
private void shiftLeftAndInsert(int index, TItem item) {
|
||||
if(index == 0) {
|
||||
AddFirst(item);
|
||||
} else {
|
||||
|
|
@ -93,7 +93,7 @@ namespace Nuclex.Support.Collections {
|
|||
|
||||
// If the first block is full, we need to add another block
|
||||
if(this.firstBlockStartIndex == 0) {
|
||||
this.blocks.Insert(0, new ItemType[this.blockSize]);
|
||||
this.blocks.Insert(0, new TItem[this.blockSize]);
|
||||
this.blocks[0][this.blockSize - 1] = this.blocks[1][0];
|
||||
this.firstBlockStartIndex = this.blockSize - 1;
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ namespace Nuclex.Support.Collections {
|
|||
/// </summary>
|
||||
/// <param name="index">Index the item will be inserted at</param>
|
||||
/// <param name="item">Item that will be inserted</param>
|
||||
private void shiftRightAndInsert(int index, ItemType item) {
|
||||
private void shiftRightAndInsert(int index, TItem item) {
|
||||
if(index == this.count) {
|
||||
AddLast(item);
|
||||
} else {
|
||||
|
|
@ -167,7 +167,7 @@ namespace Nuclex.Support.Collections {
|
|||
|
||||
// If the lastmost block is full, we need to add another block
|
||||
if(this.lastBlockEndIndex == this.blockSize) {
|
||||
this.blocks.Add(new ItemType[this.blockSize]);
|
||||
this.blocks.Add(new TItem[this.blockSize]);
|
||||
this.blocks[lastBlock + 1][0] = this.blocks[lastBlock][this.blockSize - 1];
|
||||
this.lastBlockEndIndex = 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue