BRL.LinkedList: | Functions | Types | Modinfo | Source |
Function ClearList( list:TList ) | |
Description | Clear a linked list. |
Information | Removes all objects from list. |
Function CountList( list:TList ) | |
Returns | The numbers of objects in list. |
Description | Count list length. |
Function CreateList:TList() | |
Returns | A new linked list object. |
Description | Create a linked list. |
Example | ' createlist.bmx ' create a list to hold some objects list:TList=createlist() ' add some string objects to the list listaddlast list,"one" listaddlast list,"two" listaddlast list,"three" ' enumerate all the strings in the list for a$=eachin list print a$ next |
Function ListAddFirst:TLink( list:TList,value:Object ) | |
Returns | A link object. |
Description | Add an object to a linked list. |
Function ListAddLast:TLink( list:TList,value:Object ) | |
Returns | A link object. |
Description | Add an object to a linked list. |
Function ListContains( list:TList,value:Object ) | |
Returns | True if list contains value, else false. |
Description | Check if list contains a value. |
Function ListFindLink:TLink( list:TList,value:Object ) | |
Returns | The link containting value. |
Description | Find a link in a list. |
Function ListFromArray:TList( arr:Object[] ) | |
Returns | A new linked list. |
Description | Create a list from an array. |
Function ListIsEmpty( list:TList ) | |
Returns | True if list is empty, else false. |
Description | Check if list is empty. |
Function ListRemove( list:TList,value:Object ) | |
Description | Remove an object from a linked list. |
Information | ListRemove scans a list for the specified value and removes its link. |
Function ListToArray:Object[]( list:TList ) | |
Returns | An array of objects. |
Description | convert a list to an array. |
Function RemoveLink( link:TLink ) | |
Description | Remove an object from a linked list. |
Information | RemoveLink is more efficient than ListRemove. |
Function ReverseList( list:TList ) | |
Description | Reverse the order of elements of a list. |
Function SortList( list:TList,ascending=True,compareFunc( o1:Object,o2:Object )=CompareObjects ) | |
Description | Sort a list. |
Function SwapLists( list_x:TList,list_y:TList ) | |
Description | Swap the contents of 2 lists. |
Type TLink | |
Description | Link Object used by TList. |
Method NextLink:TLink() | |
Description | Returns the next link in the List. |
Method PrevLink:TLink() | |
Description | Returns the previous link in the List. |
Method Remove() | |
Description | Removes the link from the List. |
Method Value:Object() | |
Description | Returns the Object associated with this Link. |
Type TList Extends TData | |
Description | Linked List. |
Method AddFirst:TLink( value:Object ) | |
Returns | A link object. |
Description | Add an object to the start of the list. |
Method AddLast:TLink( value:Object ) | |
Returns | A link object. |
Description | Add an object to the end of the list. |
Method Clear() | |
Description | Clear a linked list. |
Information | Removes all objects from list. |
Method Contains( value:Object ) | |
Returns | True if list contains value, else false. |
Description | Check if list contains a value. |
Method Copy:TList() | |
Description | Creates an identical copy of the list. |
Method Count() | |
Returns | The numbers of objects in list. |
Description | Count list length. |
Method FindLink:TLink( value:Object ) | |
Description | Returns the first link in the list with the given value, or null if none found. |
Method First:Object() | |
Description | Returns the first object in the list. |
Information | Throws an exception if the list is empty. |
Method FirstLink:TLink() | |
Description | Returns the first link the list or null if the list is empty. |
Method IndexOfValue( value:Object ) | |
Description | Returns the index position of the given value. |
Information | Returns -1 if value not found in the list. |
Method InsertAfterLink:TLink( value:Object,pred:TLink ) | |
Description | Inserts an object after the specified list link. |
Method InsertBeforeLink:TLink( value:Object,succ:TLink ) | |
Description | Inserts an object before the specified list link. |
Method IsEmpty() | |
Returns | True if list is empty, else false. |
Description | Check if list is empty. |
Method Last:Object() | |
Description | Returns the last object in the list. |
Information | Throws an exception if the list is empty. |
Method LastLink:TLink() | |
Description | Returns the last link the list or null if the list is empty. |
Method Remove( value:Object ) | |
Description | Remove an object from a linked list. |
Information | Remove scans a list for the specified value and removes its link. |
Method RemoveFirst:Object() | |
Description | Removes and returns the first object in the list. |
Information | Throws an exception if the list is empty. |
Method RemoveLast:Object() | |
Description | Removes and returns the last object in the list. |
Information | Throws an exception if the list is empty. |
Method Reverse() | |
Description | Reverse the order of the list. |
Method Reversed:TList() | |
Description | Creates a new list that is the reversed version of this list. |
Method Sort( ascending=True,compareFunc( o1:Object,o2:Object )=CompareObjects ) | |
Description | Sort a list in either ascending (default) or decending order. |
Information | User types should implement a Compare method in order to be sorted. |
Method Swap( list:TList ) | |
Description | Swap contents with the list specified. |
Method ToArray:Object[]() | |
Returns | An array of objects. |
Description | convert a list to an array. |
Method ValueAtIndex:Object( index ) | |
Description | Returns the value of the link at the given index. |
Information | Throws an exception if the index is out of range (must be 0..list.Count()-1 inclusive). |
Function FromArray:TList( arr:Object[] ) | |
Returns | A new linked list. |
Description | Create a list from an array. |
Type TListEnum | |
Description | Enumerator Object use by TList in order to implement Eachin support. |
Version | 1.07 |
---|---|
Author | Mark Sibly |
License | Blitz Shared Source Code |
Copyright | Blitz Research Ltd |
Modserver | BRL |
Version | 1.07 |
Version | IndexOfValue method added to TList |
History | 1.06 Release |
History | Added optional CompareFunc parameter to Sort |
History | 1.05 Release |
History | Sort now swaps links instead of values |