
com.thanglequoc.aqicalculator.PollutantsBreakpoint Maven / Gradle / Ivy
Show all versions of aqi-calculator Show documentation
package com.thanglequoc.aqicalculator;
import java.util.ArrayList;
import java.util.List;
/**
* PollutantsBreakpoint, which represent the whole AQI breakpoint table
*
* It contain a list of smaller PollutantBreakpoint, each
* PollutantBreakpoint in this list represent breakpoint of a
* pollutant code
*
* @author ThangLeQuoc
*/
class PollutantsBreakpoint {
private List breakpoints;
/**
* Instantiates a new pollutants breakpoint .
*/
PollutantsBreakpoint() {
breakpoints = new ArrayList<>();
}
void addPollutantBreakpoint(PollutantBreakpoint pollutantBreakpoint) {
this.breakpoints.add(pollutantBreakpoint);
}
PollutantBreakpoint getBreakpointOfPollutant(Pollutant pollutant) {
for (PollutantBreakpoint pollutantBreakpoint : breakpoints) {
if (pollutantBreakpoint.getPollutant().equals(pollutant)) {
return pollutantBreakpoint;
}
}
return null;
}
}