ExposedList: spaces to tabs

This commit is contained in:
ZimM 2015-02-28 03:13:12 +02:00
parent 0df69e04fd
commit c7644ec0ad

View File

@ -44,7 +44,7 @@ namespace Spine {
private const int DefaultCapacity = 4; private const int DefaultCapacity = 4;
private static readonly T[] EmptyArray = new T[0]; private static readonly T[] EmptyArray = new T[0];
private int _version; private int version;
public ExposedList() { public ExposedList() {
Items = EmptyArray; Items = EmptyArray;
@ -81,10 +81,10 @@ namespace Spine {
if (Count == Items.Length) if (Count == Items.Length)
GrowIfNeeded(1); GrowIfNeeded(1);
Items[Count ++] = item; Items[Count ++] = item;
_version++; version++;
} }
private void GrowIfNeeded(int newCount) { public void GrowIfNeeded(int newCount) {
int minimumSize = Count + newCount; int minimumSize = Count + newCount;
if (minimumSize > Items.Length) if (minimumSize > Items.Length)
Capacity = Math.Max(Math.Max(Capacity * 2, DefaultCapacity), minimumSize); Capacity = Math.Max(Math.Max(Capacity * 2, DefaultCapacity), minimumSize);
@ -125,7 +125,7 @@ namespace Spine {
AddCollection(c); AddCollection(c);
else else
AddEnumerable(collection); AddEnumerable(collection);
_version++; version++;
} }
public int BinarySearch(T item) { public int BinarySearch(T item) {
@ -141,10 +141,10 @@ namespace Spine {
return Array.BinarySearch<T>(Items, index, count, item, comparer); return Array.BinarySearch<T>(Items, index, count, item, comparer);
} }
public void Clear() { public void Clear(bool clearArray = true) {
Array.Clear(Items, 0, Items.Length); Array.Clear(Items, 0, Items.Length);
Count = 0; Count = 0;
_version++; version++;
} }
public bool Contains(T item) { public bool Contains(T item) {
@ -327,7 +327,7 @@ namespace Spine {
GrowIfNeeded(1); GrowIfNeeded(1);
Shift(index, 1); Shift(index, 1);
Items[index] = item; Items[index] = item;
_version++; version++;
} }
private void CheckCollection(IEnumerable<T> collection) { private void CheckCollection(IEnumerable<T> collection) {
@ -351,7 +351,7 @@ namespace Spine {
else else
InsertEnumeration(index, collection); InsertEnumeration(index, collection);
} }
_version++; version++;
} }
private void InsertCollection(int index, ICollection<T> collection) { private void InsertCollection(int index, ICollection<T> collection) {
@ -410,7 +410,7 @@ namespace Spine {
if (i == Count) if (i == Count)
return 0; return 0;
_version++; version++;
// Remove any additional items // Remove any additional items
for (j = i + 1; j < Count; j++) { for (j = i + 1; j < Count; j++) {
@ -429,7 +429,7 @@ namespace Spine {
throw new ArgumentOutOfRangeException("index"); throw new ArgumentOutOfRangeException("index");
Shift(index, -1); Shift(index, -1);
Array.Clear(Items, Count, 1); Array.Clear(Items, Count, 1);
_version++; version++;
} }
public void RemoveRange(int index, int count) { public void RemoveRange(int index, int count) {
@ -437,40 +437,40 @@ namespace Spine {
if (count > 0) { if (count > 0) {
Shift(index, -count); Shift(index, -count);
Array.Clear(Items, Count, count); Array.Clear(Items, Count, count);
_version++; version++;
} }
} }
public void Reverse() { public void Reverse() {
Array.Reverse(Items, 0, Count); Array.Reverse(Items, 0, Count);
_version++; version++;
} }
public void Reverse(int index, int count) { public void Reverse(int index, int count) {
CheckRange(index, count); CheckRange(index, count);
Array.Reverse(Items, index, count); Array.Reverse(Items, index, count);
_version++; version++;
} }
public void Sort() { public void Sort() {
Array.Sort<T>(Items, 0, Count, Comparer<T>.Default); Array.Sort<T>(Items, 0, Count, Comparer<T>.Default);
_version++; version++;
} }
public void Sort(IComparer<T> comparer) { public void Sort(IComparer<T> comparer) {
Array.Sort<T>(Items, 0, Count, comparer); Array.Sort<T>(Items, 0, Count, comparer);
_version++; version++;
} }
public void Sort(Comparison<T> comparison) { public void Sort(Comparison<T> comparison) {
Array.Sort<T>(Items, comparison); Array.Sort<T>(Items, comparison);
_version++; version++;
} }
public void Sort(int index, int count, IComparer<T> comparer) { public void Sort(int index, int count, IComparer<T> comparer) {
CheckRange(index, count); CheckRange(index, count);
Array.Sort<T>(Items, index, count, comparer); Array.Sort<T>(Items, index, count, comparer);
_version++; version++;
} }
public T[] ToArray() { public T[] ToArray() {
@ -529,7 +529,7 @@ namespace Spine {
internal Enumerator(ExposedList<T> l) internal Enumerator(ExposedList<T> l)
: this() { : this() {
this.l = l; this.l = l;
ver = l._version; ver = l.version;
} }
public void Dispose() { public void Dispose() {
@ -539,7 +539,7 @@ namespace Spine {
private void VerifyState() { private void VerifyState() {
if (l == null) if (l == null)
throw new ObjectDisposedException(GetType().FullName); throw new ObjectDisposedException(GetType().FullName);
if (ver != l._version) if (ver != l.version)
throw new InvalidOperationException( throw new InvalidOperationException(
"Collection was modified; enumeration operation may not execute."); "Collection was modified; enumeration operation may not execute.");
} }