File: FAST_ARRAY.html

package info (click to toggle)
lisaac 1%3A0.13.1-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 15,232 kB
  • ctags: 6,386
  • sloc: ansic: 242,479; xml: 635; lisp: 333; makefile: 119; sh: 73; asm: 38
file content (189 lines) | stat: -rwxr-xr-x 17,246 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
<!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="FAST_ARRAY.html"><font color="#008000">FAST_ARRAY</font></a>[<font color="#008000">E</font>];
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">author</font></strong>      :=<font color="#BC8F8F">"Boutet Jerome (boutet@loria.fr)"</font>;
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">comment</font></strong>     :=<font color="#BC8F8F">"Resizable, fixed lower bound array.\
                  \Unlike ARRAY, the `lower' bound of a FAST_ARRAY is frozen \
                  \to 0. Thus, some memory is saved and looping toward `lower' \
                  \bound (which is 0) run a little bit faster."</font>;
		  		  
  <br><font FACE="Sans-serif" color="#000000"><B> General purpose resizable FAST_ARRAYs. The only difference with ARRAY is the </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> fact that the `lower' bound is actually frozen to 0. The `item' access is likely</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> to be more efficient as well as loop going from `upper' to `lower' just because </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> `lower' is 0. Keep in mind that even if the `lower' is frozen to 0</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> it is really better to use the `lower' attribute, and not 0 directly, just because </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> you may decide in the future to use another COLLECTION implementation.</B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Like ARRAY, the FAST_ARRAY implementation uses only one chunk of memory, the </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> `storage' area which is a NATIVE_ARRAY. One must keep in mind that this internal </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> `storage' area is always kept left align. Thus, you can expect good performances </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> while using a FAST_ARRAY to modelize a stack behavior with </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> `add_last' / `last' / `remove_last'. Conversely `add_first' and `remove_first' are </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> likely to slow down your program if they are too often used. If the fact that </B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> `lower' is stuck to 0 do matter, also consider ARRAY.</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_arrayed_collection</font></strong>:<strong><font color="#A020F0">Expanded</font></strong> <a href="ARRAYED_COLLECTION.html"><font color="#008000">ARRAYED_COLLECTION</font></a>[<font color="#008000">E</font>];
  
<br><br><strong><font color="#A020F0">Section</font></strong> <strong><font color="#A020F0">Public</font></strong>
  
  <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><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Frozen lower bound.</font></strong></em>
  
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Creation and modification:</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> new_count:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Make array with range [0 .. `new_count' - 1].</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  When `new_count' = 0 the array is empty.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">create_with_capacity</font></strong> new_count:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<font color="#008000">SELF</font> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Create an empty array with at least `needed_capacity'.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">create_with_native_array_byte</font></strong> na:<a href="NATIVE_ARRAY.html"><font color="#008000">NATIVE_ARRAY</font></a>[<a href="UINTEGER_8.html"><font color="#008000">UINTEGER_8</font></a>] <strong><font color="#0000FF">size</font></strong> s:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<font color="#008000">SELF</font> <-
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">make_with_map_object</font></strong> obj:<a href="OBJECT.html"><font color="#008000">OBJECT</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  BSBS: A revoir.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">make_with_native_array_byte</font></strong> na:<a href="NATIVE_ARRAY.html"><font color="#008000">NATIVE_ARRAY</font></a>[<a href="UINTEGER_8.html"><font color="#008000">UINTEGER_8</font></a>] <strong><font color="#0000FF">size</font></strong> s:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">make</font></strong> new_count:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Make array with range [0 .. `new_count' - 1].</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  When `new_count' = 0 the array is empty.</font></strong></em>
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">with_capacity</font></strong> needed_capacity:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Create an empty array with at least `needed_capacity'.</font></strong></em>
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Hashable.</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">hash_code</font></strong>:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Modification:</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">set_capacity</font></strong> new_capacity:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Resize capacity the array, but not count.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">resize</font></strong> new_count:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Resize the array. When `new_count' is greater than</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  `count', new positions are initialized with appropriate</font></strong></em>
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  default values.</font></strong></em>
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Implementation of deferred:</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_empty</font></strong>:<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  end is_empty</font></strong></em>
    
  <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><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">put</font></strong> element:<font color="#008000">E</font> <strong><font color="#0000FF">to</font></strong> i:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">add_first</font></strong> element:<font color="#008000">E</font> <-
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">add_last</font></strong> element:<font color="#008000">E</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  end count</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">copy</font></strong> other:<a href="FAST_ARRAY.html"><font color="#008000">FAST_ARRAY</font></a>[<font color="#008000">E</font>] <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Copy `other' onto Current.</font></strong></em>
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">set_all_with</font></strong> v:<font color="#008000">E</font> <-
   
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Sort    </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">bubble_sort</font></strong> <-
  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  Bubble sort :-( => BSBS: Optmize with Quick sort...</font></strong></em>
    
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B></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">from_collection</font></strong> model:<a href="COLLECTION.html"><font color="#008000">COLLECTION</font></a>[<font color="#008000">E</font>] <-
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> '<font color="#B8860B">==</font>'  <strong><font color="#A020F0">Right</font></strong> <font color="#A020F0">60</font> other:<a href="COLLECTION.html"><font color="#008000">COLLECTION</font></a>[<font color="#008000">E</font>] :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <-
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">is_equal_map</font></strong> other:<font color="#008000">SELF</font> :<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <- 
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">all_default</font></strong>:<a href="BOOLEAN.html"><font color="#008000">BOOLEAN</font></a> <- 
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">occurrences</font></strong> element:<font color="#008000">E</font> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_occurrences</font></strong> element:<font color="#008000">E</font> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">first_index_of</font></strong> element:<font color="#008000">E</font> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">index_of</font></strong> element:<font color="#008000">E</font> <strong><font color="#0000FF">start</font></strong> start_index:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">reverse_index_of</font></strong> element:<font color="#008000">E</font> <strong><font color="#0000FF">start</font></strong> start_index:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_first_index_of</font></strong> element:<font color="#008000">E</font> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_index_of</font></strong> element:<font color="#008000">E</font> <strong><font color="#0000FF">start</font></strong> start_index:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">fast_reverse_index_of</font></strong> element:<font color="#008000">E</font> <strong><font color="#0000FF">start</font></strong> start_index:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  	  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">subarray</font></strong> min:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <strong><font color="#0000FF">to</font></strong> max:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> :<font color="#008000">SELF</font> <-  <br><em><strong><font color="#707070">&nbsp &nbsp &nbsp &nbsp  slice</font></strong></em>
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">force</font></strong> element:<font color="#008000">E</font> <strong><font color="#0000FF">to</font></strong> index:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">remove_first</font></strong> <- 
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">remove_head</font></strong> n:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
      
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">remove</font></strong> index:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <- 
    
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">remove</font></strong> beg:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <strong><font color="#0000FF">to</font></strong> end:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
  
  <br><br><strong><font color="#FF0000">&nbsp &nbsp -</font></strong> <strong><font color="#0000FF">remove_since</font></strong> beg:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
      
  <br><font FACE="Sans-serif" color="#000000"><B></B></font>
  <br><font FACE="Sans-serif" color="#000000"><B> Guru Section.</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">set_upper</font></strong> new_up:<a href="INTEGER.html"><font color="#008000">INTEGER</font></a> <-
 
</body>
</html>