Skip to content

Commit 1e11502

Browse files
author
David R. MacIver
committed
remove trailing whitespace from IntAllocator
1 parent 38eb747 commit 1e11502

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

projects/client/RabbitMQ.Client/src/util/IntAllocator.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ namespace RabbitMQ.Util
6565

6666

6767
/**
68-
* A class for allocating integer IDs in a given range.
69-
*/
68+
* A class for allocating integer IDs in a given range.
69+
*/
7070
public class IntAllocator{
7171

7272
private IntervalList Base;
7373

7474
private readonly int[] unsorted;
7575
private int unsortedCount = 0;
7676

77-
/**
77+
/**
7878
* A class representing a list of inclusive intervals
7979
*/
8080
public class IntervalList{
8181
public IntervalList(int start, int end){
8282
this.Start = start;
83-
this.End = end;
83+
this.End = end;
8484
}
8585

8686
public int Start;
@@ -93,13 +93,13 @@ public IntervalList(int start, int end){
9393
// Invariant: None of the Intervals in the two lists may overlap
9494
// intervals in this list.
9595
public static IntervalList Merge(IntervalList x, IntervalList y)
96-
{
96+
{
9797
if(x == null) return y;
9898
if(y == null) return x;
9999

100100
if(x.End > y.Start) return Merge(y, x);
101101

102-
Debug.Assert(x.End != y.Start);
102+
Debug.Assert(x.End != y.Start);
103103

104104
// We now have x, y non-null and x.End < y.Start.
105105

@@ -138,7 +138,7 @@ public static IntervalList FromArray(int[] xs, int length)
138138
result = interval;
139139
current = interval;
140140
}
141-
else
141+
else
142142
{
143143
current.Next = interval;
144144
current = interval;
@@ -149,7 +149,7 @@ public static IntervalList FromArray(int[] xs, int length)
149149
}
150150
}
151151

152-
/**
152+
/**
153153
* Creates an IntAllocator allocating integer IDs within the inclusive range [start, end]
154154
*/
155155
public IntAllocator(int start, int end)
@@ -163,7 +163,7 @@ public IntAllocator(int start, int end)
163163

164164
/**
165165
* Allocate a fresh integer from the range, or return -1 if no more integers
166-
* are available. This operation is guaranteed to run in O(1)
166+
* are available. This operation is guaranteed to run in O(1)
167167
*/
168168
public int Allocate()
169169
{
@@ -188,12 +188,12 @@ private void Flush()
188188
}
189189

190190

191-
/**
192-
* Make the provided integer available for allocation again. This operation
193-
* runs in amortized O(sqrt(range size)) time: About every sqrt(range size)
194-
* operations will take O(range_size + number of intervals) to complete and
191+
/**
192+
* Make the provided integer available for allocation again. This operation
193+
* runs in amortized O(sqrt(range size)) time: About every sqrt(range size)
194+
* operations will take O(range_size + number of intervals) to complete and
195195
* the rest run in constant time.
196-
*
196+
*
197197
* No error checking is performed, so if you double Free or Free an integer
198198
* that was not originally Allocated the results are undefined. Sorry.
199199
*/
@@ -211,7 +211,7 @@ public bool Reserve(int id)
211211
// We always flush before reserving because the only way to determine
212212
// if an ID is in the unsorted array is through a linear scan. This leads
213213
// us to the potentially expensive situation where there is a large unsorted
214-
// array and we reserve several IDs, incurring the cost of the scan each time.
214+
// array and we reserve several IDs, incurring the cost of the scan each time.
215215
// Flushing makes sure the array is always empty and does no additional work if
216216
// reserve is called twice.
217217
Flush();
@@ -228,18 +228,18 @@ public bool Reserve(int id)
228228
else if(current.Start > id)
229229
{
230230
return false;
231-
}
231+
}
232232
else if(current.End == id)
233233
{
234234
current.End--;
235-
}
235+
}
236236
else if(current.Start == id)
237237
{
238238
current.Start++;
239-
}
240-
else
239+
}
240+
else
241241
{
242-
// The ID is in the middle of this interval.
242+
// The ID is in the middle of this interval.
243243
// We need to split the interval into two.
244244
IntervalList rest = new IntervalList(id + 1, current.End);
245245
current.End = id - 1;

0 commit comments

Comments
 (0)