Lines Matching refs:index

237      * Return index of bucket that contains or is immediately before the
241 int index = Arrays.binarySearch(bucketStart, 0, bucketCount, time);
242 if (index < 0) {
243 index = (~index) - 1;
245 index -= 1;
247 return MathUtils.constrain(index, 0, bucketCount - 1);
251 * Return index of bucket that contains or is immediately after the
255 int index = Arrays.binarySearch(bucketStart, 0, bucketCount, time);
256 if (index < 0) {
257 index = ~index;
259 index += 1;
261 return MathUtils.constrain(index, 0, bucketCount - 1);
389 final int index = Arrays.binarySearch(bucketStart, 0, bucketCount, now);
390 if (index < 0) {
392 insertBucket(~index, now);
398 * Insert new bucket at requested index and starting time.
400 private void insertBucket(int index, long start) {
414 if (index < bucketCount) {
415 final int dstPos = index + 1;
416 final int length = bucketCount - index;
418 System.arraycopy(bucketStart, index, bucketStart, dstPos, length);
419 if (activeTime != null) System.arraycopy(activeTime, index, activeTime, dstPos, length);
420 if (rxBytes != null) System.arraycopy(rxBytes, index, rxBytes, dstPos, length);
421 if (rxPackets != null) System.arraycopy(rxPackets, index, rxPackets, dstPos, length);
422 if (txBytes != null) System.arraycopy(txBytes, index, txBytes, dstPos, length);
423 if (txPackets != null) System.arraycopy(txPackets, index, txPackets, dstPos, length);
424 if (operations != null) System.arraycopy(operations, index, operations, dstPos, length);
427 bucketStart[index] = start;
428 setLong(activeTime, index, 0L);
429 setLong(rxBytes, index, 0L);
430 setLong(rxPackets, index, 0L);
431 setLong(txBytes, index, 0L);
432 setLong(txPackets, index, 0L);
433 setLong(operations, index, 0L);