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.Collect): IContainer!(V);
- Circular linked list
Iterator iterator ()
uint opApply (int delegate(ref V value) dg)
CircularList add (V element)
CircularList addAt (uint index, V element)
CircularList append (V element)
CircularList prepend (V element)
uint addAt (uint index, IContainer!(V) e)
uint append (IContainer!(V) e)
uint prepend (IContainer!(V) e)
bool take (ref V v)
bool contains (V element)
V get (uint index)
uint first (V element, uint startingIndex = 0)
uint last (V element, uint startingIndex = 0)
V head ()
V tail ()
V head (V element)
V tail (V element)
V removeHead ()
V removeTail ()
bool removeAt (uint index)
uint remove (V element, bool all)
uint removeRange (uint fromIndex, uint toIndex)
uint replace (V oldElement, V newElement, bool all)
bool replaceAt (uint index, V element)
uint size ()
bool isEmpty ()
V[] toArray (V[] dst)
CircularList dup ()
CircularList subset (uint from, uint length)
CircularList clear ()
CircularList reset ()
CircularList check ()
- this();
- Make an empty list
- this(Ref h, uint c);
- Make an configured list
- Alloc
allocator
();
- Return the configured
allocator
- Iterator
iterator
();
- Return a generic
iterator
for contained elements
- int
opApply
(int delegate(ref V value) dg);
- uint
size
();
- Return the number of elements contained
- CircularList
dup
();
- Make an independent copy of the list. Elements themselves
are not cloned
- bool
contains
(V element);
- Time complexity: O(n)
- V
head
();
- Time complexity: O(1)
- V
tail
();
- Time complexity: O(1)
- V
get
(uint index);
- Time complexity: O(n)
- uint
first
(V element, uint startingIndex = 0);
- Time complexity: O(n)
- uint
last
(V element, uint startingIndex = 0);
- Time complexity: O(n)
- CircularList
subset
(uint from, uint length);
- Time complexity: O(length)
- CircularList
clear
();
- Time complexity: O(1)
- CircularList
reset
();
- 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);
- Time complexity: O(n)
Takes the last element on the list
- CircularList
prepend
(V element);
- Time complexity: O(1)
- V
head
(V element);
- Time complexity: O(1)
- V
removeHead
();
- Time complexity: O(1)
- CircularList
add
(V element);
- Time complexity: O(1)
- CircularList
append
(V element);
- Time complexity: O(1)
- V
tail
(V element);
- Time complexity: O(1)
- V
removeTail
();
- Time complexity: O(1)
- CircularList
addAt
(uint index, V element);
- Time complexity: O(n)
- CircularList
replaceAt
(uint index, V element);
- Time complexity: O(n)
- CircularList
removeAt
(uint index);
- Time complexity: O(n)
- uint
remove
(V element, bool all);
- Time complexity: O(n)
- uint
replace
(V oldElement, V newElement, bool all);
- Time complexity: O(n)
- uint
prepend
(IContainer!(V) e);
- Time complexity: O(number of elements in e)
- uint
append
(IContainer!(V) e);
- Time complexity: O(number of elements in e)
- uint
addAt
(uint index, IContainer!(V) e);
- Time complexity: O(size() + number of elements in e)
- uint
removeRange
(uint fromIndex, uint toIndex);
- Time complexity: O(n)
- V[]
toArray
(V[] dst = null);
- 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
();
- Is this container empty?
Time complexity: O(1)
- CircularList
check
();
- uint
instances
(V element);
- Time complexity: O(n)
- void
checkIndex
(uint i);
- Ref
firstCell
();
- return the first cell, or throw exception if empty
- Ref
lastCell
();
- return the last cell, or throw exception if empty
- Ref
cellAt
(uint index);
- return the index'th cell, or throw exception if bad index
- CircularList
clear
(bool all);
- Time complexity: O(1)
- void
increment
();
- new element was added
- void
decrement
(Ref p);
- element was removed
- void
mutate
();
- set was changed
- struct
Iterator
;
-
Iterator
with no filtering
- bool
valid
();
- Did the container change underneath us?
- bool
next
(ref V v);
- Accesses the
next
value, and returns false when
there are no further values to traverse
- V*
next
();
- Return a pointer to the
next
value, or null when
there are no further values to traverse
- int
opApply
(int delegate(ref V value) dg);
- Foreach support
- bool
remove
();
- Remove value at the current iterator location
- Iterator
reverse
();
- Ref
fore
(Ref p);
- Ref
back
(Ref p);
|