Переглянути джерело

Added some missing functions for linked lists

Carl Husberg 5 роки тому
батько
коміт
b26d5b2528
1 змінених файлів з 32 додано та 0 видалено
  1. 32 0
      linkedlist.mod/linkedlist.bmx

+ 32 - 0
linkedlist.mod/linkedlist.bmx

@@ -587,6 +587,22 @@ Function ListAddLast:TLink( list:TList,value:Object )
 	Return list.AddLast( value )
 	Return list.AddLast( value )
 End Function
 End Function
 
 
+Rem
+bbdoc: Returns the first object in the list
+about: Returns Null if the list is empty.
+End Rem
+Function ListGetFirst:Object( list:TList )
+	Return list.First()
+EndFunction
+
+Rem
+bbdoc: Returns the last object in the list
+about: Returns Null if the list is empty.
+End Rem
+Function ListGetLast:Object( list:TList )
+	Return list.Last()
+EndFunction
+
 Rem
 Rem
 bbdoc: Add an object to a linked list
 bbdoc: Add an object to a linked list
 returns: A link object
 returns: A link object
@@ -595,6 +611,22 @@ Function ListAddFirst:TLink( list:TList,value:Object )
 	Return list.AddFirst( value )
 	Return list.AddFirst( value )
 End Function
 End Function
 
 
+Rem
+bbdoc: Removes and returns the first object in the list.
+about: Returns Null if the list is empty.
+End Rem
+Function ListRemoveFirst:Object( list:TList )
+	Return list.RemoveFirst()
+End Function
+
+Rem
+bbdoc: Removes and returns the last object in the list.
+about: Returns Null if the list is empty.
+End Rem
+Function ListRemoveLast:Object( list:TList )
+	Return list.RemoveLast()
+End Function
+
 Rem
 Rem
 bbdoc: Remove an object from a linked list
 bbdoc: Remove an object from a linked list
 about: #ListRemove scans a list for the specified value and removes its link.
 about: #ListRemove scans a list for the specified value and removes its link.