root/tags/lgt2210/library/queuep.lgt

Revision 365, 2.0 KB (checked in by pmoura, 6 years ago)

Changed "authors" key in info/1 directive to "author".

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- protocol(queuep).
3
4
5    :- info([
6        version is 1.0,
7        author is 'Paulo Moura',
8        date is 2000/7/24,
9        comment is 'Queue protocol.']).
10
11
12    :- public(empty/1).
13
14    :- mode(empty(@queue), zero_or_one).
15
16    :- info(empty/1, [
17        comment is 'True if the queue is empty.',
18        argnames is ['Queue']]).
19
20
21    :- public(head/2).
22
23    :- mode(head(+queue, ?term), zero_or_one).
24
25    :- info(head/2, [
26        comment is 'Unifies Head with the first element of the queue.',
27        argnames is ['Queue', 'Head']]).
28
29
30    :- public(join/3).
31
32    :- mode(join(@term, +queue, -queue), zero_or_one).
33
34    :- info(join/3, [
35        comment is 'Adds the new element at the end of the queue.',
36        argnames is ['Element', 'Queue_in', 'Queue_out']]).
37
38
39    :- public(join_all/3).
40
41    :- mode(join_all(+list, +queue, -queue), zero_or_one).
42
43    :- info(join_all/3, [
44        comment is 'Adds the new elements at the end of the queue.  The elements are added in the same order that they appear in the list.',
45        argnames is ['List', 'Queue_in', 'Queue_out']]).
46
47
48    :- public(jump/3).
49
50    :- mode(jump(@term, +queue, -queue), zero_or_one).
51
52    :- info(jump/3, [
53        comment is 'Adds the new element at the front of the queue.',
54        argnames is ['Element', 'Queue_in', 'Queue_out']]).
55
56
57    :- public(jump_all/3).
58
59    :- mode(jump_all(+list, +queue, -queue), zero_or_one).
60
61    :- info(jump_all/3, [
62        comment is 'Adds the new elements at the front of the queue.  The elements are added in the same order that they appear in the list.',
63        argnames is ['Element', 'Queue_in', 'Queue_out']]).
64
65
66    :- public(length/2).
67
68    :- mode(length(+queue, ?integer), zero_or_one).
69
70    :- info(length/2,
71        [comment is 'Queue length.',
72         argnames is ['Queue', 'Length']]).
73
74
75    :- public(serve/3).
76
77    :- mode(serve(+queue, ?term, -queue), zero_or_one).
78
79    :- info(serve/3, [
80        comment is 'Removes the first element of the queue for service.',
81        argnames is ['Queue_in', 'Head', 'Queue_out']]).
82
83
84    :- public(as_list/2).
85
86    :- mode(as_list(+queue, -list), one).
87
88    :- info(as_list/2,
89        [comment is 'Converts a queue to a list.',
90         argnames is ['Queue', 'List']]).
91
92
93:- end_protocol.
Note: See TracBrowser for help on using the browser.