- Inherits from:
- Object
- Conforms to:
- DQueuable, DStackable
- Declared in:
- DList.h
Object
|
+---DList
Class Description
The DList class implements a number of methods for manipulating double linked
lists.
- Direct subclasses:
- DSortedList
- Last modified:
- 31-Oct-2007 (DList.h)
Instance Variables
- private DListNode *_first
- the start of the list
- private DListNode *_last
- the end of the list
- private long _count
- the number of nodes in the list
- Constructors
- - (DList *) init
- Initialise an empty list
- Returns:
- the list
- Copy related methods
- - deepen
- Deepen a copied object
- Returns:
- the object
- - shallowCopy
- Do a shallow copy of the object
- Returns:
- the copy
- Deconstructor
- - free
- (Deep) free the list (the stored objects are *FREED*)
- Returns:
- the instance
- - shallowFree
- Free the list (the stored objects are *NOT* freed)
- Returns:
- the instance
- Member methods
- - (BOOL) isEmpty
- Check if the list is empty
- Returns:
- is the list empty ?
- - (long) length
- Return the length of the list
- Returns:
- the number of nodes in the list
- List manipulation methods
- - (DList *) append :(id) object
- Append an object to the list
- Parameters:
- object - the object that must be appended
- Returns:
- the instance
- - (long) count :(id) object
- Count the number of occurrences of an object in the list
- Parameters:
- object - the object that must be counted (incl. nil)
- Returns:
- the number of occurrences
- - (id) delete :(long) index
- Delete a list node
- Parameters:
- index - the index in the list
- Returns:
- the stored object
- - (DList *) delete :(long) from :(long) to
- Delete a range of list nodes
- Parameters:
- from - the first index in the list
to - the last index in the list (to >= from)
- Returns:
- a (new) list with the deleted list nodes
- - (DList *) each :(SEL) sel
- Perform a method for every object in the list
- Parameters:
- sel - the selector of the method
- Returns:
- the object
- - (id) get :(long) index
- Get the object in a list node
- Parameters:
- index - the index in the list
- Returns:
- the stored object
- - (DList *) get :(long) from :(long) to
- Get a range of objects from the list
- Parameters:
- from - the start index from the range
to - the end index from the range
- Returns:
- a (new) list with (references) to the objects
- - (BOOL) has :(id) object
- Check if the object is in the list
- Parameters:
- object - the object that must be located in the list
- Returns:
- is the object in the list ?
- - (long) index :(id) object
- Find the smallest index where an object is located
- Parameters:
- object - the object that must be located
- Returns:
- the index in the list (or -1 if not found)
- - (DList *) insert :(long) index :(id) object
- Insert an object in the list on the given index
- Parameters:
- index - the index in the list (-n..+n)
object - the object to be inserted
- Returns:
- the list
- - (DList *) prepend :(id) object
- Prepend an object to the list
- Parameters:
- object - the object that must be prepended
- Returns:
- the list
- - (BOOL) remove :(id) object
- Remove the first occurrence of an object in the list
- Parameters:
- object - the object that must be removed from the list
- Returns:
- success
- - (long) replace :(id) orig :(id) repl :(long) max
- Replace in the list max times every occurence of the original object
by the replacement (orig in NOT freed)
- Parameters:
- orig - the original object
repl - the replacement object
max - the maximum number of replacements (-1 = all)
- Returns:
- the number of actual replacements
- - (DList *) reverse
- Reverse the list
- Returns:
- the list object
- - (long) rindex :(id) object
- Find the largest index where an object is located
- Parameters:
- object - the object that must be located in the list
- Returns:
- the index in the list (or -1 if not found)
- - (id) set :(long) index :(id) object
- Set the object in a list node
- Parameters:
- index - the index in the list
object - the object to be set
- Returns:
- the previous stored object
- Stackable protocol methods
- - (id) pop
- Pop the last node from the list and returns the object
- Returns:
- the object from the list (or nil)
- - (BOOL) push :(id) obj
- Push a new node with the object at the end of the list
- Parameters:
- obj - the object to be pushed
- Returns:
- success
- - (id) tos
- Return the object in the last node of the list
- Returns:
- the object (or nil if empty)
- Queuable protocol methods
- - (id) dequeue
- Dequeue the first object from the list
- Returns:
- the object (or nil for buffer empty)
- - (BOOL) enqueue :(id) obj
- Enqueue the object at the end of the list
- Parameters:
- obj - the object
- Returns:
- success
- String methods
- + (DList *) split :(const char *) string :(char) seperator :(int) maxsplits
- Split a string in a list of strings
- Parameters:
- string - the string to be splitted
seperator - the seperator character
maxsplits - the maximum number of splits (or -1 for all)
- Returns:
- a (new) list with string objects
- - (DText *) join :(char) seperator
- Join the list of strings to one string
- Parameters:
- seperator - the seperator to be used
- Returns:
- the new string with the joined strings
generated 05-Nov-2007 by ObjcDoc 3.0.0