@@ -55,7 +55,7 @@ export interface ArrayViewInterface<T> {
55
55
*
56
56
* @returns {ArraySelectorInterface } Boolean mask for selecting elements that satisfy the predicate.
57
57
*/
58
- is ( predicate : ( value : T ) => boolean ) : ArraySelectorInterface ;
58
+ is ( predicate : ( value : T ) => boolean ) : MaskSelectorInterface ;
59
59
60
60
/**
61
61
* Returns a subview of this view based on a selector or string slice.
@@ -105,6 +105,80 @@ export interface ArrayViewInterface<T> {
105
105
[ Symbol . iterator ] ( ) : IterableIterator < T > ;
106
106
}
107
107
108
+ /**
109
+ * Represents a slice definition for selecting a range of elements.
110
+ */
111
+ export interface SliceInterface {
112
+ /**
113
+ * The start index of the slice range.
114
+ */
115
+ readonly start : number | undefined ;
116
+ /**
117
+ * The end index of the slice range.
118
+ */
119
+ readonly end : number | undefined ;
120
+ /**
121
+ * The step size for selecting elements in the slice range.
122
+ */
123
+ readonly step : number | undefined ;
124
+
125
+ /**
126
+ * Normalizes the slice parameters based on the container length.
127
+ *
128
+ * @param {number } containerLength - The length of the container or array.
129
+ *
130
+ * @returns {NormalizedSlice } The normalized slice parameters.
131
+ */
132
+ normalize ( containerLength : number ) : NormalizedSliceInterface ;
133
+
134
+ /**
135
+ * Returns the string representation of the Slice.
136
+ *
137
+ * @returns {string } The string representation of the Slice.
138
+ */
139
+ toString ( ) : string ;
140
+ }
141
+
142
+ /**
143
+ * Represents a normalized slice definition with start, end, and step values.
144
+ */
145
+ export interface NormalizedSliceInterface extends SliceInterface {
146
+ /**
147
+ * The start index of the normalized slice.
148
+ */
149
+ readonly start : number ;
150
+ /**
151
+ * The end index of the normalized slice.
152
+ */
153
+ readonly end : number ;
154
+ /**
155
+ * The step size for selecting elements in the normalized slice.
156
+ */
157
+ readonly step : number ;
158
+ /**
159
+ * Returns the length of the normalized slice.
160
+ *
161
+ * @type {number }
162
+ */
163
+ readonly length : number ;
164
+
165
+ /**
166
+ * Converts the provided index to the actual index based on the normalized slice parameters.
167
+ *
168
+ * @param {number } i - The index to convert.
169
+ *
170
+ * @returns {number } The converted index value.
171
+ */
172
+ convertIndex ( i : number ) : number ;
173
+
174
+ /**
175
+ * Generate an iterator for iterating over the elements in the normalized slice range.
176
+ *
177
+ * @returns {IterableIterator<number> } An iterator for the normalized slice range.
178
+ */
179
+ toRange ( ) : IterableIterator < number > ;
180
+ }
181
+
108
182
/**
109
183
* Interface for selecting elements from an array view.
110
184
*/
@@ -122,6 +196,31 @@ export interface ArraySelectorInterface {
122
196
select < T > ( source : ArrayViewInterface < T > , readonly ?: boolean ) : ArrayViewInterface < T > ;
123
197
}
124
198
199
+ /**
200
+ * Interface for selecting elements from an array view by boolean mask.
201
+ */
202
+ export interface MaskSelectorInterface extends ArraySelectorInterface {
203
+ /**
204
+ * Boolean mask array.
205
+ */
206
+ readonly value : Array < boolean > ;
207
+ }
208
+
209
+ /**
210
+ * Interface for selecting elements from an array view by boolean mask.
211
+ */
212
+ export interface IndexListSelectorInterface extends ArraySelectorInterface {
213
+ /**
214
+ * Index list array.
215
+ */
216
+ readonly value : Array < number > ;
217
+ }
218
+
219
+ /**
220
+ * Interface for selecting elements from an array view by slice.
221
+ */
222
+ export interface SliceSelectorInterface extends ArraySelectorInterface , SliceInterface { }
223
+
125
224
/**
126
225
* Type representing an array that can be sliced.
127
226
*
0 commit comments