annotate dwt/dwthelper/array.d @ 122:2e671fa40eec

Ported dwt.dnd, dwt.opengl, dwt.printing and dwt.program
author Jacob Carlborg <doob@me.com>
date Wed, 31 Dec 2008 21:01:13 +0100
parents d32621bf0f90
children 63a09873578e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
1 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
2 * Copyright: Copyright (c) 2008 Jacob Carlborg. All rights reserved.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
3 * Authors: Jacob Carlborg
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
4 * Version: Initial created: 2008
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
5 * License: $(LINK2 http://opensource.org/licenses/bsd-license.php, BSD Style)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
6 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
7 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
8 module dwt.dwthelper.array;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
9
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
10 version (Tango)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
11 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
12 static import tango.text.Util;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
13 static import tango.core.Array;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
14 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
15
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
16 else
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
17 version = Phobos;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
18
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
19 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
20 * Appends the specified element to the end of the array.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
21 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
22 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
23 * arr = the array to add the element to
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
24 * element = element to be appended to this list
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
25 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
26 * Returns: the modified array
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
27 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
28 * Throws: AssertException if the length of the array is 0
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
29 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
30 T[] add (T) (ref T[] arr, T element)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
31 in
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
32 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
33 assert(arr.length > 0);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
34 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
35 body
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
36 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
37 return arr ~= element;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
38 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
39
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
40 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
41 * Appends the specified element to the end of the array.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
42 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
43 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
44 * arr = the array to add the element to
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
45 * element = element to be appended to this list
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
46 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
47 * Returns: the modified array
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
48 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
49 * Throws: AssertException if the length of the array is 0
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
50 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
51 alias add addElement;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
52
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
53 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
54 * Gets the element at the specified index
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
55 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
56 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
57 * arr = the array to get the element from
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
58 * index = the index of the element to get
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
59 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
60 * Returns: the element at the specified index
99
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
61 *
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
62 * Throws: AssertException if the length of the array is 0
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
63 * AssertException if the $(D_CODE index) is greater than the length of the array
60
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
64 */
122
2e671fa40eec Ported dwt.dnd, dwt.opengl, dwt.printing and dwt.program
Jacob Carlborg <doob@me.com>
parents: 99
diff changeset
65 T elementAt (T) (T[] arr, int index)
60
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
66 in
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
67 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
68 assert(arr.length > 0);
122
2e671fa40eec Ported dwt.dnd, dwt.opengl, dwt.printing and dwt.program
Jacob Carlborg <doob@me.com>
parents: 99
diff changeset
69 assert(index > -1 && index < arr.length);
60
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
70 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
71 body
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
72 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
73 return arr[index];
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
74 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
75
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
76 /**
99
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
77 * Gets the element at the specified position in the array
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
78 *
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
79 * Params:
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
80 * arr = the array to get the element from
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
81 * index = the index of the element to get
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
82 *
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
83 * Returns: the element at the specified position
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
84 *
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
85 * Throws: AssertException if the length of the array is 0
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
86 * AssertException if the $(D_CODE index) is greater than the length of the array
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
87 */
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
88 alias elementAt get;
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
89
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
90 /**
60
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
91 * Returns the number of elements in the specified array.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
92 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
93 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
94 * arr = the array to get the number of elements from
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
95 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
96 * Returns: the number of elements in this list
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
97 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
98 size_t size (T) (T[] arr)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
99 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
100 return arr.length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
101 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
102
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
103 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
104 * Removes the element at the specified position in the array
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
105 * if it could find it and returns it.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
106 * Shifts any subsequent elements to the left.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
107 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
108 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
109 * arr = the array to remove the element from
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
110 * index = the index of the element to be removed
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
111 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
112 * Returns: the element that was removed or $(D_CODE null)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
113 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
114 * Throws: AssertException if the length of the array is 0
99
d32621bf0f90 Ported dwt.dnd.DropTarget
Jacob Carlborg <doob@me.com>
parents: 60
diff changeset
115 * AssertException if the $(D_CODE index) argument is
60
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
116 * negative or not less than the length of this array.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
117 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
118 T remove (T) (ref T[] arr, int index)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
119 in
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
120 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
121 assert(arr.length > 0);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
122 assert(index > -1 && index < arr.length);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
123 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
124 body
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
125 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
126 T ret = arr[index];
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
127
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
128 // NOTE: Indexes are passed instead of references because DMD does
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
129 // not inline the reference-based version.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
130 void exch (size_t p1, size_t p2)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
131 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
132 T t = arr[p1];
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
133 arr[p1] = arr[p2];
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
134 arr[p2] = t;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
135 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
136
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
137 size_t cnt = 0;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
138
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
139 for (size_t pos = 0, len = arr.length; pos < len; ++pos)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
140 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
141 if (pos == index)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
142 ++cnt;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
143 else
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
144 exch(pos, pos - cnt);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
145 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
146
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
147 arr = arr[0 .. $ - cnt];
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
148
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
149 return ret;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
150 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
151
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
152 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
153 * Removes the specified element from the array
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
154 * if it could find it and returns it.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
155 * Shifts any subsequent elements to the left.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
156 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
157 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
158 * arr = the array to remove the element from
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
159 * element = the element to be removed
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
160 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
161 * Returns: the element that was removed or $(null null)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
162 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
163 * Throws: AssertException if the length of the array is 0
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
164 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
165 T remove (T) (ref T[] arr, T element)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
166 in
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
167 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
168 assert(arr.length > 0);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
169 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
170 out (result)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
171 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
172 assert(result is element || result is null);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
173 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
174 body
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
175 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
176 int index = arr.indexOf(element);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
177
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
178 if (index == -1)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
179 return null;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
180
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
181 return arr.remove(index);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
182 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
183
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
184 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
185 * Removes the specified element from the array
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
186 * if it could find it and returns it.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
187 * Shifts any subsequent elements to the left.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
188 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
189 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
190 * arr = the array to remove the element from
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
191 * element = the element to be removed
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
192 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
193 * Returns: the element that was removed or $(null null)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
194 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
195 * Throws: AssertException if the length of the array is 0
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
196 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
197 alias remove removeElement;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
198
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
199 /**
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
200 * Returns the index of the first occurrence of the specified element
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
201 * in the array, or -1 if the array does not contain the element.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
202 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
203 * Params:
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
204 * arr = the array to get the index of the element from
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
205 * element = the element to find
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
206 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
207 * Returns: the index of the element or -1 if it's not in the array
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
208 *
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
209 * Throws: AssertException if the length of the array is 0
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
210 * Throws: AssertException if the return value is less than -1 or
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
211 * greater than the length of the array - 1.
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
212 */
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
213 size_t indexOf (T, U = uint) (T[] arr, T element, U start = 0)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
214 in
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
215 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
216 assert(arr.length > 0);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
217 assert(start >= 0);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
218 assert(element !is null);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
219 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
220 out (result)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
221 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
222 assert(result >= -1 && result < arr.length);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
223 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
224 body
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
225 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
226 uint index;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
227
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
228 version (Tango)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
229 index = tango.text.Util.locate(arr, element);
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
230
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
231 else
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
232 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
233 if (start > arr.length)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
234 start = arr.length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
235
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
236 index = privateIndexOf(arr.ptr, element, arr.length - start) + start;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
237 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
238
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
239 if (index == arr.length)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
240 index = -1;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
241
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
242 return index;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
243
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
244 version (Phobos)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
245 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
246 // tango.text.Util.locate
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
247 uint privateIndexOf (T* str, T match, uint length)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
248 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
249 version (D_InlineAsm_X86)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
250 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
251 static if (T.sizeof == 1)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
252 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
253 asm
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
254 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
255 mov EDI, str;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
256 mov ECX, length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
257 movzx EAX, match;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
258 mov ESI, ECX;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
259 and ESI, ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
260 jz end;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
261
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
262 cld;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
263 repnz;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
264 scasb;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
265 jnz end;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
266 sub ESI, ECX;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
267 dec ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
268 end:;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
269 mov EAX, ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
270 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
271 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
272 else static if (T.sizeof == 2)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
273 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
274 asm
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
275 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
276 mov EDI, str;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
277 mov ECX, length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
278 movzx EAX, match;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
279 mov ESI, ECX;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
280 and ESI, ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
281 jz end;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
282
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
283 cld;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
284 repnz;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
285 scasw;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
286 jnz end;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
287 sub ESI, ECX;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
288 dec ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
289 end:;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
290 mov EAX, ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
291 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
292 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
293
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
294 else static if (T.sizeof == 4)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
295 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
296 asm
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
297 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
298 mov EDI, str;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
299 mov ECX, length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
300 mov EAX, match;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
301 mov ESI, ECX;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
302 and ESI, ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
303 jz end;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
304
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
305 cld;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
306 repnz;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
307 scasd;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
308 jnz end;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
309 sub ESI, ECX;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
310 dec ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
311 end:;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
312 mov EAX, ESI;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
313 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
314 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
315
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
316 else
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
317 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
318 auto len = length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
319
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
320 for (auto p = str - 1; len--; )
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
321 if (*++p is match)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
322 return p - str;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
323
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
324 return length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
325 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
326 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
327
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
328 else
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
329 {
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
330 auto len = length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
331
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
332 for (auto p = str - 1; len--; )
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
333 if (*++p is match)
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
334 return p - str;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
335
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
336 return length;
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
337 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
338 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
339 }
62202ce0039f Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
diff changeset
340 }