Rename queryCount -> queryIndex
queryCount was "the count of queries until now, excluding this one",
which isn't as clear as "queryIndex" (especially in calculations).
queryIndex is a more usual way to name something that starts at 0 and
increases by one with each instance.
Test: atest
Change-Id: Id763decf7d2db7462c296955d6123cb1b14585fe
diff --git a/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java b/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java
index 1e53d15..4e74159 100644
--- a/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java
+++ b/service-t/src/com/android/server/connectivity/mdns/QueryTaskConfig.java
@@ -57,9 +57,9 @@
private final int burstCounter;
final long delayBeforeTaskWithoutBackoffMs;
private final boolean isFirstBurst;
- private final long queryCount;
+ private final long queryIndex;
- QueryTaskConfig(long queryCount, int transactionId,
+ QueryTaskConfig(long queryIndex, int transactionId,
boolean expectUnicastResponse, boolean isFirstBurst, int burstCounter,
int queriesPerBurst, int timeBetweenBurstsInMs,
long delayBeforeTaskWithoutBackoffMs) {
@@ -70,7 +70,7 @@
this.burstCounter = burstCounter;
this.delayBeforeTaskWithoutBackoffMs = delayBeforeTaskWithoutBackoffMs;
this.isFirstBurst = isFirstBurst;
- this.queryCount = queryCount;
+ this.queryIndex = queryIndex;
}
QueryTaskConfig(int queryMode) {
@@ -98,7 +98,7 @@
this.timeBetweenBurstsInMs = INITIAL_TIME_BETWEEN_BURSTS_MS;
this.delayBeforeTaskWithoutBackoffMs = TIME_BETWEEN_QUERIES_IN_BURST_MS;
}
- this.queryCount = 0;
+ this.queryIndex = 0;
}
long getDelayBeforeNextTaskWithoutBackoff(boolean isFirstQueryInBurst,
@@ -137,7 +137,7 @@
* Get new QueryTaskConfig for next run.
*/
public QueryTaskConfig getConfigForNextRun(int queryMode) {
- long newQueryCount = queryCount + 1;
+ long newQueryCount = queryIndex + 1;
int newTransactionId = transactionId + 1;
if (newTransactionId > UNSIGNED_SHORT_MAX_VALUE) {
newTransactionId = 1;
@@ -174,6 +174,6 @@
if (burstCounter != 0 || isFirstBurst) {
return false;
}
- return queryCount > numOfQueriesBeforeBackoff;
+ return queryIndex > numOfQueriesBeforeBackoff;
}
}