ajlist


Data type AjPListNode

Substructure of AjPList

Attributes

NameTypeDescription
Nextnext item
Prevprevious item
Itemdata value


Data type AjPList

List data object. Lists are simple linked lists with performance optimised to allow rapid extension of the beginning or end of the list.

Lists can hold any data type. Special functions are available for lists of AjPStr values. In general, these functions are the same. Many are provided for ease of use to save remembering which calls need special cases.

Constructor(s)

NameDescription
ajListNewCreates a new general list.
ajListstrNewCreates a new AjPStr list.
ajListNewArgsCreate a new list, create the nodes and add the other arguments as data.
ajListstrNewArgsCreate a new AjPStr list, create the nodes and add the other arguments as data.
ajListCopyCopies a list to a new list.
ajListstrCopyCopies an AjPStr list to a new list.

Destructor(s)

NameDescription
ajListFreeFree the list, and free the items with a simple "free".
ajListstrFreeFree the list, and free the items with ajStrDel
ajListDelFree the list but do not try to free the nodes. Nodes should be freed first by ajListMap.
ajListstrDelFree the list but do not try to free the nodes. use where nodes are still in use, e.g. in ajListToArray.

Modifier(s)

NameDescription
ajListPushAdd a new node at the start of a list.
ajListstrPushAdd a new node at the start of an AjPStr list.
ajListPushAppAdd a new node at the end of a list.
ajListstrPushAppAdd a new node at the end of an AjPStr list.
ajListAppendAdd a set of nodes at the end of the list
ajListReverseReverse the order of the nodes in a list
ajListstrReverseReverse the order of the nodes in an AjPStr list
ajListMapCall a function for each node in a list.
ajListstrMapCall a function for each node in a list.
ajListPushListMerges two lists.
ajListstrPushListMerges two AjPStr lists.
ajListSortSorts a list.
ajListPopRemoves and returns the first node.
ajListstrPopRemoves and returns the first AjPStr node.

Cast(s)

NameDescription
ajListToArrayCreate an array of the pointers to the data.
ajListstrToArrayCreate an array of the pointers to the data.
ajListFirstSet pointer to first node's data. Doesn't remove the node.
ajListLastSet pointer to last node's data. Doesn't remove the node.
ajListLengthget the number of nodes in a linked list.
ajListstrLengthget the number of nodes in an AjPStr linked list.
ajListPeekReturns the first node but keeps it on the list
ajListstrPeekReturns the first node but keeps it on the list

Operator(s)

NameDescription
ajListFindFor each node in the list call a function and return ajTrue when found.
ajListstrFindFor each node in the list call a function and return ajTrue when found.

Output

NameDescription
ajListTraceTraces through a list and validates it
ajListstrTraceTraces through an AjPStr list and validates it

Attributes

NameTypeDescription
Firstfirst node
Lastdummy last node
CountNumber of nodes
TypeList type (any, string, etc.)


Data type AjIList

AJAX list iterator data structure

Attributes

NameTypeDescription
HeadHead of list
HereCurrent list node
OrigFirst list node
DirDirection of last iterative move
ModifyAllows iterator to modify the sequence

Constructor(s)

NameDescription
ajListIterDefault constructor
ajListIterReadDefault constructor for a read-only list iterator

Cast(s)

NameDescription
ajListIterDoneTests whether an iterator is finished.

Destructor(s)

NameDescription
ajListIterFreeDeletes a list iterator.

Modifier(s)

NameDescription
ajListIterNextReturns next item using iterator, or steps off the end.
ajListRemoveRemoves an item at the current iterator.
ajListstrRemoveRemoves an AjPStr item at the current iterator.
ajListInsertInserts an item at the current iterator.
ajListstrInsertInserts an AjPStr item at the current iterator.

Cast(s)

NameDescription
ajListIterMoreTests whether iterator can return another item.

Output

NameDescription
ajListIterTraceTraces a list iterator.
ajListstrIterTraceTraces an AjPStr list iterator.