ADT Definition Panel
The Abstract Data Type (ADT) definition panel is used to highlight and define an abstract data type.
\adtdef
!! Syntax
<sourcedoc> <syntax>
<descp> describe the adt. </descp> <oplist> <item op=name (arg1, arg2)> operation description ..... </item> <item opx=name (arg1, arg2)> operation description </item> </oplist> </adtdef> </syntax> <descp> Used to define and abstract data type (ADT), which consists of a description and the list of operations. The environment requires two sub blocks:
<itemize style=codedoc> <item> <verbatim>
</verbatim> Contains a description of the ADT. </item>
<item> <verbatim>
</verbatim> Contains the list of operations and a description of each. </item> </itemize>
Each @@
@@ tag must contain two parameters, either @@op@@ or @@opx@@ and a list of the operation parameters, enclosed within a pair of @@( )@@.
<itemize style='codedoc'> <item> <verbatim>op</verbatim> The name of a regular operation. </item>
<item> <verbatim>opx</verbatim> The name of an special operator type operation that is formatted with double underscores before and after the name as used in Python. </item>
<item> <verbatim>(arg1, arg2)</verbatim> The list of parameters required by the operation. </item> </itemize> </descp>
<param name> The name of the ADT (i.e. Queue), which will be displayed on the title bar of the panel as 'The Queue ADT'. </param> </sourcedoc>
The ADT Definition panel shown above is produced from the following syntax
<code style=plain>
<descp> A ''queue'' is a data structure that stores a linear collection of items in which access is restricted to a first-in first-out basis. New items are inserted at the back and existing items are removed from the front. The items are maintained in the order in which they are added to the structure. </descp> <oplist> <item op=Queue> Creates a new empty queue, which is a queue containing no items. </item> <item op=isEmpty> Returns a Boolean value indicating whether the queue is empty. </item> <item opx=length ()> Returns the number of items currently in the queue. </item> <item op=enqueue (item)> Adds the given item to the back of the queue. </item> <item op=dequeue> Removes and returns the front item from the queue. An item cannot be dequeued from an empty queue. </item> </oplist> </adtdef> </code>