/** * Tests if the WeatherData is bigger than any of the results in the current top 5, and adds if it * does Automatically pushes down the other results * * @param wd WeatherData to test and add */ public void add(WeatherData wd) { if (wd.getValue() > wd1.getValue()) { replace1(wd); } else if (wd.getValue() > wd2.getValue()) { replace2(wd); } else if (wd.getValue() > wd3.getValue()) { replace3(wd); } else if (wd.getValue() > wd4.getValue()) { replace4(wd); } else if (wd.getValue() > wd5.getValue()) { replace5(wd); } }
/** * Creates a string that represents the values in the top 5 Weather Results * * @return */ public String toStringValue() { return "ResultsTracker [wd1=" + wd1.getValue() + ", wd2=" + wd2.getValue() + ", wd3=" + wd3.getValue() + ", wd4=" + wd4.getValue() + ", wd5=" + wd5.getValue() + "]"; }