All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thanglequoc.aqicalculator.PollutantBreakpoint Maven / Gradle / Ivy

Go to download

AQI Calculator give the detail result from AQI calculation. It also supports NowCast

The newest version!
package com.thanglequoc.aqicalculator;

import java.util.List;
import java.util.Optional;

class PollutantBreakpoint {
    
    private Pollutant pollutant;
    private String unit;
    private String period;
    
    private List concentrations;
    
    PollutantBreakpoint(Pollutant code, String unit, String period) {
        this.pollutant = code;
        this.unit = unit;
        this.period = period;
    }
    
    Pollutant getPollutant() {
        return pollutant;
    }

    void setPollutantConcentrations(List pollutantConcentrations) {
        this.concentrations = pollutantConcentrations;
    }
    
    /**
     * Gets the concentration range with avg concentration.
     *
     * @param concentration the concentration
     * @return the concentration range with avg concentration
     */
    Optional getConcentrationRangeWithAvgConcentration(double concentration) {
        for (PollutantConcentration pollutantConcentration : concentrations) {
            if (concentration >= pollutantConcentration.getMinConcentration()
                    && concentration <= pollutantConcentration.getMaxConcentration()) {
                return Optional.of(pollutantConcentration);
            }
        }
        return Optional.empty();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy