Skip to content

Instantly share code, notes, and snippets.

@roberton
Created September 9, 2014 12:55
Show Gist options
  • Select an option

  • Save roberton/2ea2e550443d6983777a to your computer and use it in GitHub Desktop.

Select an option

Save roberton/2ea2e550443d6983777a to your computer and use it in GitHub Desktop.
Example of Connascence of Position
@Override
public ProviderResponseStatistics getStatisticsFor(String provider) {
database = openHelper.getReadableDatabase();
int minimumResponseTime = Integer.MAX_VALUE;
int maxinumResponseTime = Integer.MIN_VALUE;
Cursor cursor = database.query("call", null, null, null, null, null, null);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
int responseTime = cursor.getInt(2);
minimumResponseTime = (responseTime < minimumResponseTime) ? responseTime : minimumResponseTime;
maxinumResponseTime = (responseTime > maxinumResponseTime) ? responseTime : maxinumResponseTime;
cursor.moveToNext();
}
return new ProviderResponseStatistics(provider, minimumResponseTime, maxinumResponseTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment