NAME
prioqueue - Create and manipulate prioqueue objects
SYNOPSIS
package require TTccll 88..22 package require ssttrruucctt ??11..33??::::ssttrruucctt::::pprriiooqquueeuuee ?-aasscciiii||-ddiiccttiioonnaarryy||-iinntteeggeerr||-rreeaall? ?prioqueueName?
prioqueueName ooppttiioonn ?arg arg ...?
prioqueueName cclleeaarr
prioqueueName ddeessttrrooyy
prioqueueName ggeett ?count?
prioqueueName ppeeeekk ?count?
prioqueueName ppeeeekkpprriioorriittyy ?count?
prioqueueName ppuutt item prio ?item prio ...?
prioqueueName ssiizzee
DESCRIPTION
This package implements a simple priority queue using nested tcl lists. The command ::::ssttrruucctt::::pprriiooqquueeuuee creates a new priority queue withdefault priority key type -integer. This means that keys given to the
ppuutt subcommand must have this type.This also sets the priority ordering. For key types -ascii and -dictio-
nary the data is sorted in ascending order (as with llssoorrtt -increasing),
thereas for -integer and -real the data is sorted in descending order
(as with llssoorrtt -decreasing).
Prioqueue names are unrestricted, but may be recognized as options if no priority type is given.::::ssttrruucctt::::pprriiooqquueeuuee ?-aasscciiii||-ddiiccttiioonnaarryy||-iinntteeggeerr||-rreeaall? ?prioqueueName?
The ::::ssttrruucctt::::pprriiooqquueeuuee command creates a new prioqueue object
with an associated global Tcl command whose name is prioqueue-
Name. This command may be used to invoke various operations onthe prioqueue. It has the following general form:
prioqueueName ooppttiioonn ?arg arg ...?
ooppttiioonn and the args determine the exact behavior of the command.The following commands are possible for prioqueue objects:
prioqueueName cclleeaarr
Remove all items from the prioqueue.
prioqueueName ddeessttrrooyy
Destroy the prioqueue, including its storage space and associ-
ated command.prioqueueName ggeett ?count?
Return the front count items of the prioqueue (but not their
priorities) and remove them from the prioqueue. If count is not
specified, it defaults to 1. If count is 1, the result is a simple string; otherwise, it is a list. If specified, count must be greater than or equal to 1. If there are no or too fewitems in the prioqueue, this command will throw an error.
prioqueueName ppeeeekk ?count?
Return the front count items of the prioqueue (but not their
priorities), without removing them from the prioqueue. If count
is not specified, it defaults to 1. If count is 1, the result is a simple string; otherwise, it is a list. If specified, count must be greater than or equal to 1. If there are no or too few items in the queue, this command will throw an error.prioqueueName ppeeeekkpprriioorriittyy ?count?
Return the front count items priority keys, without removingthem from the prioqueue. If count is not specified, it defaults
to 1. If count is 1, the result is a simple string; otherwise, it is a list. If specified, count must be greater than or equalto 1. If there are no or too few items in the queue, this com-
mand will throw an error.prioqueueName ppuutt item prio ?item prio ...?
Put the item or items specified into the prioqueue. prio must be
a valid priority key for this type of prioqueue, otherwise an
error is thrown and no item is added. Items are inserted at their priority ranking. Items with equal priority are added in the order they were added.prioqueueName ssiizzee
Return the number of items in the prioqueue.
KKEEYYWWOORRDDSSordered list, prioqueue, priority queue
COPYRIGHT Copyright (c) 2003 Michael Schlenkerstruct 1.3 prioqueue(n)