فهرست منبع

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 )
 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
 bbdoc: Add an object to a linked list
 returns: A link object
@@ -595,6 +611,22 @@ Function ListAddFirst:TLink( list:TList,value:Object )
 	Return list.AddFirst( value )
 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
 bbdoc: Remove an object from a linked list
 about: #ListRemove scans a list for the specified value and removes its link.