- Inherits from:
- DList
- Declared in:
- DSortedList.h
Object
|
+---DList
|
+---DSortedList
Class Description
The DSortedList class implements a number of methods for using a sorted double linked
lists. This class maintains a sorted list. During inserting of objects this list is
kept sorted. As a result a number of insert related methods of the parent class DList
are disabled and return a warning.
- Last modified:
- 31-Oct-2007 (DSortedList.h)
Instance Variables
- private BOOL _ascending
- is the list sorted ascending ? (else descending)
- private Class _class
- the class of the objects
- Constructors
- - (DSortedList *) init
- Initialise an empty ascending sorted list
- Returns:
- the list
- - (DSortedList *) init :(Class) class :(BOOL) ascending
- Initialise a sorted list
- Parameters:
- class - the class of the objects (conforms to comparable protocol)
ascending - should the list be sorted ascending ?
- Returns:
- the list
- 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) ascending
- Is the list sorted ascending ?
- Returns:
- is it ?
- - (DSortedList *) ascending :(BOOL) ascending
- Set the sorting direction
- Parameters:
- ascending - should the list be sorted ascending ?
- Returns:
- the list
- - (Class) class
- Return the class of the objects in the list
- Returns:
- the class (or Nil)
- - (DSortedList *) class :(Class) class
- Set the class of the objects in the list (only if list is empty)
- Parameters:
- class - the class for the objects in the list
- Returns:
- the object
- List manipulation methods
- - (DSortedList *) append :(id) object
- Append an object to the list (Not allowed)
- Parameters:
- object - the object that must be appended
- Returns:
- the instance
- - (DSortedList *) insert :(id) object
- Insert an object sorted in the list
- Parameters:
- object - the object to be inserted
- Returns:
- the object
- - (DSortedList *) insert :(long) index :(id) object
- Insert an object in the list on the given index (Not allowed)
- Parameters:
- index - the index in the list (-n..+n)
object - the object to be inserted
- Returns:
- the list
- - (DSortedList *) prepend :(id) object
- Prepend an object to the list (Not allowed)
- Parameters:
- object - the object that must be prepended
- Returns:
- the list
- - (DSortedList *) reverse
- Reverse the list
- Returns:
- the list object
- - (id) set :(long) index :(id) object
- Set the object in a list node (Not allowed)
- Parameters:
- index - the index in the list
object - the object to be set
- Returns:
- the previous stored object
- Stackable protocol methods
- - (BOOL) push :(id) obj
- Push a new node with the object at the end of the list (Not allowed)
- Parameters:
- obj - the object to be pushed
- Returns:
- success
- Queuable protocol methods
- - (BOOL) enqueue :(id) obj
- Enqueue the object at the end of the list (Not allowed)
- Parameters:
- obj - the object
- Returns:
- success
- String methods
- + (DSortedList *) splitSorted :(const char *) string :(char) seperator :(int) maxsplits
- Split a string in a list of sorted strings (ascending)
- Parameters:
- string - the string to be splitted
seperator - the seperator character
maxsplits - the maximum number of splits (or -1 for all)
- Returns:
- a (new) sorted list with string objects
generated 05-Nov-2007 by ObjcDoc 3.0.0