upContainers

by Unknown Person
A library that implements basic data structures used in everyday programming.
ID:91613
 
Latest Version: 2.0

upContainers is a library that defines and implements primitive data structures used in everyday programming. Currently, the library defines stacks (/Stack), queues (/Queue), sets (/Set), and many other common data easily implementable structures. Documentation is located in the library.

Structures:
- Stack (/Stack)
- Queue (/Queue)
- Set (/Set)
- Deque (/Deque)
- Linked List (/LinkedList)
- Doubly-Linked List (/DLinkedList)

Example code:
#include <UnknownPerson/upContainers>

mob/verb/stack_test()
var/Stack/S = new /Stack (list(1,2,3,4,5))

S.Push(6)
S.Push(7)

while(!S.isEmpty())
src << S.Pop()

mob/verb/linked_list_test()
var/LinkedList/L = new /LinkedList (list(5,2,3,7))

L.DeleteFront()
var/lNode/new_node = lNode(L, 7)
L.Insert(new_node)

for(var/lNode/n = L.getFront(), n != null, n = n.getNext())
src << n.getData()


Release Info:

Version 2.0 (May 31st, 2008)
- Added the Linked List (/LinkedList) and Doubly-Linked List structure (/DLinkedList), which utilizes the Linked Node structures (/lNode and /dlNode) to store data
- Added the Deque structure (/Deque), which allows pushing and popping from both sides of the line. (IainPeregrine, Hiead)
- Added the /Set/Copy(), which returns a duplicate of a set
- Empty sets and queues would give a runtime error on getTop(), getFront(), and getBack() (Thurnok)
- Sets, Queues, and Stacks now support single-item initialization. If a non-list value is submitted through the first arg, the container object will be initialized with the single value. (Thurnok)
- Stacks, Sets and Queues did not properly assign an internal list if an initializer list was sent through New()

Version 1.0 (May 9th, 2008)
- library released (features sets, queues, and stacks)