File: SET.html

package info (click to toggle)
lisaac 1%3A0.13.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 15,276 kB
  • ctags: 6,396
  • sloc: ansic: 242,479; xml: 635; lisp: 333; makefile: 116; sh: 73; asm: 38
file content (226 lines) | stat: -rwxr-xr-x 19,291 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!DOCTYPE HTML SYSTEM>
<!-- Generated by Lisaac shorter / html style -->
<html>
<head>
<title>
Lisaac prototype interface
</title>
</head>
<body BGCOLOR="#FFFFFF">

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<br><br><strong><font color="#A020F0">Section</font></strong> <strong><font color="#A020F0">Header</font></strong>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp +</font></strong> <strong><font color="#0000FF">name</font></strong> := <a href="SET.html"><font color="#008000">SET</font></a>[<font color="#008000">E</font>];
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">comment</font></strong> := <font color="#BC8F8F">"Definition of a mathematical set of objects."</font>;

  <br><font FACE="Sans-serif" color="#000000"><B> All common operations on mathematical sets are available.</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Well knowned implementations are HASHED_SET and AVL_SET.</B></font>
  
<br><br><strong><font color="#A020F0">Section</font></strong> <strong><font color="#A020F0">Inherit</font></strong>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp +</font></strong> <strong><font color="#0000FF">parent_traversable</font></strong>:<a href="TRAVERSABLE.html"><font color="#008000">TRAVERSABLE</font></a>[<font color="#008000">E</font>] := 
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp +</font></strong> <strong><font color="#0000FF">parent_safe_equal</font></strong>:<a href="SAFE_EQUAL.html"><font color="#008000">SAFE_EQUAL</font></a>[<font color="#008000">E</font>] := 
  
<br><br><strong><font color="#A020F0">Section</font></strong> <strong><font color="#A020F0">Public</font></strong>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Counting:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">count</font></strong>:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Cardinality of the set (i.e. actual `count' of stored elements).</font></strong></em>
  	
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">is_empty</font></strong>:<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <- 
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Is the set empty?</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Adding and removing:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">add</font></strong> e:<font color="#008000">E</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Add new item `e' to the set. The mathematical definition of adding </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  in a set is followed, i.e. the element `e' is added only and only </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  if it is not yet present in the set.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  As this `add' feature is actually using `is_equal', you may consider </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  to use `fast_add' for expanded objects as well while trying to get </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  the very best performances.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_add</font></strong> e:<font color="#008000">E</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Same job as `add', but uses basic `=' for comparison.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">remove</font></strong> e:<font color="#008000">E</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Remove item `e' from the set: the mathematical definition of</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  removing from a set is followed.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_remove</font></strong> e:<font color="#008000">E</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Same job as `remove', but uses basic `=' for comparison.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">clear</font></strong> <- 
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">clear_count</font></strong> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Empty the current set (`is_empty' is True after that call). </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  If possible, the actual implementation is supposed to keep </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  its internal storage area in order to refill `Current' in </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  an efficient way.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `clear_count_and_capacity' to select the most appropriate.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">clear_count_and_capacity</font></strong> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Empty the current set (`is_empty' is True after that call). </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  If possible, the actual implementation is supposed to release </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  its internal storage area for this memory to be used by other objects.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `clear_count' to select the most appropriate.</font></strong></em>
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Looking and searching:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">has</font></strong> e:<font color="#008000">E</font> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Is element `e' in the set?</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  As this query is actually using `is_equal', you may consider to use </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  `fast_has' for expanded objects as well while trying to get the very </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  best performances.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_has</font></strong> e:<font color="#008000">E</font> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Is element `e' actually stored in the set?</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Warning: this query is using basic `=' for comparison. </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `has' when dealing with reference types.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">reference_at</font></strong> e:<font color="#008000">E</font> :<font color="#008000">E</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Non Void when `e' is in the set. In such a situation, `Result' is the </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  object which is actually stored in the `Current' set (see ensure assertion).</font></strong></em>
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> To provide iterating facilities:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">lower</font></strong>:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> := 

  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">upper</font></strong>:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">item</font></strong> i:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<font color="#008000">E</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Item at the corresponding index `i'.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `lower', `upper', `valid_index'.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  SETs are intrinsically unordered, so there is no guarantee that </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  `item'(i) after performing an `add' or `remove' operation is related </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  in any way to `item'(i) before that operation.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">first</font></strong>:<font color="#008000">E</font> <- 
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  The very `first' item.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `last', `item'.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  SETs are intrinsically unordered, so there is no guarantee that </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  `first' after performing an `add' or `remove' operation is related </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  in any way to `first' before that operation.</font></strong></em>

  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">last</font></strong>:<font color="#008000">E</font> <- 
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  The `last' item.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `first', `item'.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  SETs are intrinsically unordered, so there is no guarantee that </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  `last' after performing an `add' or `remove' operation is related </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  in any way to `last' before that operation.</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Mathematical operations:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">union</font></strong> other:<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Make the union of the `Current' set with `other'.</font></strong></em>
  	
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> '<font color="#B8860B">+</font>' other:<font color="#008000">SELF</font> :<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Return the union of the `Current' set with `other'.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">intersection</font></strong> other:<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Make the intersection of the `Current' set with `other'.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> '<font color="#B8860B">^</font>' other:<font color="#008000">SELF</font> :<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Return the intersection of the `Current' set with `other'.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">minus</font></strong> other:<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Make the set `Current' - `other'.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> '<font color="#B8860B">-</font>' other:<font color="#008000">SELF</font> :<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Return  the set `Current' - `other'.</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Comparison:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">is_subset_of</font></strong> other:<font color="#008000">SELF</font> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Is the `Current' set a subset of `other'?</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">is_disjoint_from</font></strong> other:<font color="#008000">SELF</font> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Is the `Current' set disjoint from `other' ?</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> '<font color="#B8860B">==</font>' other:<font color="#008000">SELF</font> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Is the `Current' set equal to `other'?</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Duplication.</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">copy</font></strong> other:<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Copy 'other' into the current set</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">from_collection</font></strong> model:<a href="COLLECTION.html"><font color="#008000">COLLECTION</font></a>[<font color="#008000">E</font>] <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Add all items of `model'.</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Agents based features:</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">do_all</font></strong> action:<a href="BLOCK.html"><font color="#008000">BLOCK</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Apply `action' to every item of `Self'.</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `for_all', `exists'.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">for_all</font></strong> predicate:<a href="BLOCK.html"><font color="#008000">BLOCK</font></a> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Do all items satisfy `predicate'?</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `do_all', `exists'.</font></strong></em>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">exists</font></strong> predicate:<a href="BLOCK.html"><font color="#008000">BLOCK</font></a> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Does at least one item satisfy `predicate'?</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp </font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  See also `do_all', `for_all'.</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Creation.</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">create</font></strong>:<font color="#008000">SELF</font> <- 
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">make</font></strong> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Creation of an empty SET.</font></strong></em>
  
</body>
</html>