BioCore  5.0.0
A Windows .NET microscopy library and application for viewing, editing, and annotating images.
Loading...
Searching...
No Matches
FloodFillRangeQueue.cs
Go to the documentation of this file.
1namespace BioCore
2{
4 public class FloodFillRangeQueue
5 {
6 FloodFillRange[] array;
7 int size;
8 int head;
9
13 public int Count
14 {
15 get { return size; }
16 }
17
18 public FloodFillRangeQueue() : this(10000)
19 {
20
21 }
22
23 public FloodFillRangeQueue(int initialSize)
24 {
25 array = new FloodFillRange[initialSize];
26 head = 0;
27 size = 0;
28 }
29
32 {
33 get { return array[head]; }
34 }
35
37 public void Enqueue(ref FloodFillRange r)
38 {
39 if (size + head == array.Length)
40 {
41 FloodFillRange[] newArray = new FloodFillRange[2 * array.Length];
42 Array.Copy(array, head, newArray, 0, size);
43 array = newArray;
44 head = 0;
45 }
46 array[head + (size++)] = r;
47 }
48
51 {
52 FloodFillRange range = new FloodFillRange();
53 if (size > 0)
54 {
55 range = array[head];
56 array[head] = new FloodFillRange();
57 head++;//advance head position
58 size--;//update size to exclude dequeued item
59 }
60 return range;
61 }
62
64 /*public void Clear()
65 {
66 if (size > 0)
67 Array.Clear(array, 0, size);
68 size = 0;
69 }*/
70
71 }
72}
A queue of FloodFillRanges.
FloodFillRange Dequeue()
Removes and returns the FloodFillRange at the beginning of the queue.
int Count
Returns the number of items currently in the queue.
FloodFillRange First
Gets the FloodFillRange at the beginning of the queue.
void Enqueue(ref FloodFillRange r)
Adds a FloodFillRange to the end of the queue.
Represents a linear range to be filled and branched from.