Lines Matching refs:range

26  * radio when the range of enabled message identifiers changes.
36 * of the caller) so that a call to remove a range can be mapped to the
37 * client that enabled that range (or else rejected).
48 * One or more clients forming the continuous range [startId, endId].
62 * @param startId the first id included in the range
63 * @param endId the last id included in the range
64 * @param client the client requesting the enabled range
110 * @param range the new ClientRange to insert
112 void insert(ClientRange range) {
117 if (range.mStartId <= nextRange.mStartId) {
119 if (!range.equals(nextRange)) {
121 if (range.mStartId == nextRange.mStartId
122 && range.mEndId > nextRange.mEndId) {
131 mClients.add(i, range);
137 mClients.add(insert, range);
140 mClients.add(range); // append to end of list
145 * The message id range for a single client.
184 * Enable a range for the specified client and update ranges
186 * false is returned and the range is not added.
188 * @param startId the first id included in the range
189 * @param endId the last id included in the range
190 * @param client the client requesting the enabled range
196 // empty range list: add the initial IntRange
207 IntRange range = mRanges.get(startIndex);
208 if ((startId) >= range.mStartId && (endId) <= range.mEndId) {
209 // exact same range: new [1, 1] existing [1, 1]
210 // range already enclosed in existing: new [3, 3], [1,3]
213 range.insert(new ClientRange(startId, endId, client));
215 } else if ((startId - 1) == range.mEndId) {
217 // found missing link? check if next range can be joined
234 range.mEndId = endId;
235 range.insert(new ClientRange(startId, endId, client));
237 // found missing link? check if next range can be joined
239 if (range.mEndId < nextRange.mEndId) {
241 range.mEndId = nextRange.mEndId;
243 range.mClients.addAll(nextRange.mClients);
250 } else if (startId < range.mStartId) {
252 // test if new range completely precedes this range
254 if ((endId + 1) < range.mStartId) {
256 // insert new int range before previous first range
263 } else if (endId <= range.mEndId) {
265 // extend the start of this range
266 if (tryAddRanges(startId, range.mStartId - 1, true)) {
267 range.mStartId = startId;
268 range.mClients.add(0, new ClientRange(startId, endId, client));
274 // find last range that can coalesce into the new combined range
279 // try to add entire new range
281 range.mStartId = startId;
282 range.mEndId = endId;
284 range.mClients.add(0, new ClientRange(startId, endId, client));
285 // coalesce range with following ranges up to endIndex-1
286 // remove each range after adding its elements, so the index
287 // of the next range to join is always startIndex+1.
294 range.mClients.addAll(joinRange.mClients);
303 // add range from start id to start of last overlapping range,
306 range.mStartId = startId;
307 range.mEndId = endRange.mEndId;
309 range.mClients.add(0, new ClientRange(startId, endId, client));
310 // coalesce range with following ranges up to endIndex
311 // remove each range after adding its elements, so the index
312 // of the next range to join is always startIndex+1.
318 range.mClients.addAll(joinRange.mClients);
331 range.mStartId = startId;
332 range.mEndId = endId;
334 range.mClients.add(0, new ClientRange(startId, endId, client));
335 // coalesce range with following ranges up to len-1
336 // remove each range after adding its elements, so the index
337 // of the next range to join is always startIndex+1.
344 range.mClients.addAll(joinRange.mClients);
352 } else if ((startId + 1) <= range.mEndId) {
354 if (endId <= range.mEndId) {
356 // completely contained in existing range; no radio changes
357 range.insert(new ClientRange(startId, endId, client));
361 // find last range that can coalesce into the new combined range
374 // add range from range.endId+1 to endId,
375 // values from startId to range.endId are already enabled
376 if (tryAddRanges(range.mEndId + 1, endId, true)) {
377 range.mEndId = endId;
378 range.insert(new ClientRange(startId, endId, client));
384 // get last range to coalesce into start range
386 // Values from startId to range.endId have already been enabled.
387 // if endId > endRange.endId, then enable range from range.endId+1 to endId,
388 // else enable range from range.endId+1 to endRange.startId-1, because
393 if (tryAddRanges(range.mEndId + 1, newRangeEndId, true)) {
395 range.mEndId = newRangeEndId;
397 range.insert(new ClientRange(startId, endId, client));
398 // coalesce range with following ranges up to endIndex
399 // remove each range after adding its elements, so the index
400 // of the next range to join is always startIndex+1 (joinIndex).
406 range.mClients.addAll(joinRange.mClients);
418 // append new range after existing IntRanges
428 * Disable a range for the specified client and update ranges
430 * false is returned and the range is not removed.
432 * @param startId the first id included in the range
433 * @param endId the last id included in the range
434 * @param client the client requesting to disable the range
441 IntRange range = mRanges.get(i);
442 if (startId < range.mStartId) {
444 } else if (endId <= range.mEndId) {
445 // found the IntRange that encloses the client range, if any
447 ArrayList<ClientRange> clients = range.mClients;
455 // remove the range from mRange then update the radio
460 // failed to update radio. insert back the range
461 mRanges.add(i, range);
472 // update succeeds, we remove the client range and insert the new IntRanges.
484 if (range.mEndId == largestEndId) {
492 range.mEndId = largestEndId;
497 range.mEndId = cr.mEndId;
506 IntRange rangeCopy = new IntRange(range, crIndex);
515 if (nextStartId != range.mStartId) {
561 mRanges.add(i, range);
593 * Enable or disable a single range of message identifiers.
594 * @param startId the first id included in the range
595 * @param endId the last id included in the range
596 * @param selected true to enable range, false to disable range
603 // This is the new range to be enabled
617 * Called when attempting to add a single range of message identifiers
630 * Called when attempting to add a single range of message identifiers
636 IntRange range = mRanges.get(i);
638 int clientLen = range.mClients.size();
640 ClientRange nextRange = range.mClients.get(j);
654 * Called after {@link #startUpdate} to indicate a range of enabled
657 * @param startId the first id included in the range
658 * @param endId the last id included in the range
659 * @param selected true to enable range, false to disable range
664 * Called to indicate the end of a range update started by the