tango.util.container.CircularList

License:

BSD style: see license.txt

Version:

Apr 2008: Initial release

Authors:

Kris

Since:

0.99.7

Based upon Doug Lea's Java collection package
class CircularList(V, alias Reap = Container.reap, alias Heap = Container.DefaultCollect) : IContainer!(V)
Circular linked list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Iterator iterator ()
int opApply (scope int delegate(ref V value) dg)

CircularList add (V element)
CircularList addAt (size_t index, V element)
CircularList append (V element)
CircularList prepend (V element)
size_t addAt (size_t index, IContainer!(V) e)
size_t append (IContainer!(V) e)
size_t prepend (IContainer!(V) e)

bool take (ref V v)
bool contains (V element)
V get (size_t index)
size_t first (V element, size_t startingIndex = 0)
size_t last (V element, size_t startingIndex = 0)

V head ()
V tail ()
V head (V element)
V tail (V element)
V removeHead ()
V removeTail ()

bool removeAt (size_t index)
size_t remove (V element, bool all)
size_t removeRange (size_t fromIndex, size_t toIndex)

size_t replace (V oldElement, V newElement, bool all)
bool replaceAt (size_t index, V element)

size_t size ()
bool isEmpty ()
V[] toArray (V[] dst)
CircularList dup ()
CircularList subset (size_t from, size_t length)
CircularList clear ()
CircularList reset ()
CircularList check ()
this()
Make an empty list
this(Ref h, size_t c) [protected]
Make an configured list
~this()
Clean up when deleted
Iterator iterator() [@property, final]
Return a generic iterator for contained elements
CircularList cache(size_t chunk, size_t count = 0) [final]
Configure the assigned allocator with the size of each allocation block (number of nodes allocated at one time) and the number of nodes to pre-populate the cache with. Time complexity: O(n)
int opApply(scope int delegate(ref V value) dg) [final]
size_t size() [@property, final, const]
Return the number of elements contained
CircularList dup() [@property, final]
Make an independent copy of the list. Elements themselves are not cloned
bool contains(V element) [final]
Time complexity: O(n)
V head() [final]
Time complexity: O(1)
V tail() [final]
Time complexity: O(1)
V get(size_t index) [final]
Time complexity: O(n)
size_t first(V element, size_t startingIndex = 0) [final]
Time complexity: O(n) Returns size_t.max if no element found.
size_t last(V element, size_t startingIndex = 0) [final]
Time complexity: O(n) Returns size_t.max if no element found.
CircularList subset(size_t from, size_t length) [final]
Time complexity: O(length)
CircularList clear() [final]
Time complexity: O(1)
CircularList reset() [final]
Reset the HashMap contents and optionally configure a new heap manager. This releases more memory than clear() does
Time complexity: O(n)
bool take(ref V v) [final]
Time complexity: O(n)
Takes the last element on the list
CircularList prepend(V element) [final]
Time complexity: O(1)
V head(V element) [final]
Time complexity: O(1)
V removeHead() [final]
Time complexity: O(1)
CircularList add(V element) [final]
Time complexity: O(1)
CircularList append(V element) [final]
Time complexity: O(1)
V tail(V element) [final]
Time complexity: O(1)
V removeTail() [final]
Time complexity: O(1)
CircularList addAt(size_t index, V element) [final]
Time complexity: O(n)
CircularList replaceAt(size_t index, V element) [final]
Time complexity: O(n)
CircularList removeAt(size_t index) [final]
Time complexity: O(n)
size_t remove(V element, bool all) [final]
Time complexity: O(n)
size_t replace(V oldElement, V newElement, bool all) [final]
Time complexity: O(n)
size_t prepend(IContainer!(V) e) [final]
Time complexity: O(number of elements in e)
size_t append(IContainer!(V) e) [final]
Time complexity: O(number of elements in e)
size_t addAt(size_t index, IContainer!(V) e) [final]
Time complexity: O(size() + number of elements in e)
size_t removeRange(size_t fromIndex, size_t toIndex) [final]
Time complexity: O(n)
V[] toArray(V[] dst = null) [final]
Copy and return the contained set of values in an array, using the optional dst as a recipient (which is resized as necessary).
Returns a slice of dst representing the container values. Time complexity: O(n)
bool isEmpty() [final, const]
Is this container empty? Time complexity: O(1)
CircularList check() [final]