Skip to content

Instantly share code, notes, and snippets.

@meatcar
Last active October 30, 2015 20:58
Show Gist options
  • Select an option

  • Save meatcar/4cc7f631fd3d869f4dab to your computer and use it in GitHub Desktop.

Select an option

Save meatcar/4cc7f631fd3d869f4dab to your computer and use it in GitHub Desktop.
How would you refactor this?
/**
* Get associated terms for this measurement with the given standard deviation value.
*
* @param standardDeviation the measurement's standard deviation value or {@code null} for all associated terms
* @return a list of terms
*/
public Collection<VocabularyTerm> getAssociatedTerms(Double standardDeviation)
{
ResourceBundle configuration = ResourceBundle.getBundle("measurementsAssociatedTerms");
List<VocabularyTerm> terms = new ArrayList<>();
if (null == standardDeviation || standardDeviation <= -3) {
addResolvedTermsToList(configuration, this.getName(), "extremeBelowNormal", terms);
}
if (null == standardDeviation || standardDeviation <= -2) {
addResolvedTermsToList(configuration, this.getName(), "belowNormal", terms);
}
if (null == standardDeviation || standardDeviation >= 2) {
addResolvedTermsToList(configuration, this.getName(), "aboveNormal", terms);
}
if (null == standardDeviation || standardDeviation >= 3) {
addResolvedTermsToList(configuration, this.getName(), "extremeAboveNormal", terms);
}
return terms;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment