Package de.bcxp.challenge.weather
Class WeatherAnalyser
java.lang.Object
de.bcxp.challenge.weather.WeatherAnalyser
- All Implemented Interfaces:
IDocumentAnalyser
Analyzes a weather document to find the entry with the smallest temperature spread.
Implements the IDocumentAnalyser
interface for WeatherEntry
objects.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBestMatches
(Document document) Finds the day with the smallest temperature spread from the provided weather document.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger
-
-
Constructor Details
-
WeatherAnalyser
public WeatherAnalyser()Instantiates stateless analyser.
-
-
Method Details
-
getBestMatches
Finds the day with the smallest temperature spread from the provided weather document.This method analyzes the list of
WeatherEntry
entries in the givenDocument
and returns the one with the smallest temperature spread (i.e., maxTemp - minTemp).- Specified by:
getBestMatches
in interfaceIDocumentAnalyser
- Parameters:
document
- the document containing a list ofWeatherEntry
entries- Returns:
- A set of
WeatherEntry
entry with the smallest temperature spread - Throws:
NoSuchElementException
- if the document contains no entries
-