Labrador::Common::SlicedQueue
my $arr = new Labrador::Common::SlicedQueue([],[], []);
$arr->push(0, 'ab'); $arr->push(0, 'ac'); #print $arr->dump; $arr->unshift(0,'aa'); $arr->push(1, 'bb'); #print $arr->dump; $arr->unshift(1, 'ba'); $arr->push(1, 'bc'); $arr->push(2, 'cc'); $arr->unshift(2, 'cb'); $arr->unshift(2, 'ca'); $arr->push(2, 'cd');
$arr->push(5, 'fa'); $arr->push(3, 'db'); $arr->push(4, 'ea'); #$arr->pop(2); #remove cd $arr->pop(5); #remove fa, remove 5; #$arr->pop(3); #remove db $arr->shift(0); #remove aa $arr->shift(3); #remove db, 3 empty $arr->shift(4); #remove ea, remove 4,5
print $arr->dump;
This object allows N lists to be kept in one object, using only three arrays for internal representation. Operations allowed on a list are push, shift, pop, unshift, get, remove.
Essentially, this object encapsulates multi-dimensional arrays in single-dimension arrays.
This object is represented by a blessed array reference, with three elements. These are, in order: Data of all arrays, Sizes of each array, the upper bound of each array.
Construct a new SlicedQueue. If external arrays are wished to be used for internal representation, pass these as the parameters to the constructor. (Ie, if you wish tied arrays for persistence).
Push @list onto the end of queue number $queue
Prepend @list onto the front of queue number $queue
Remove the contents of queue number $queue. Returns deleted values.
Remove an item from the end of queue number $queue.
Remove an item from the front of queue number $queue.
Returns the entire contents of queue number $queue.
Returns the size of queue number $queue.
Returns the number of queues
Returns a textual representation of the queues.
$Revision: 1.3 $