// Path: app/src/main/java/com/waynedgrant/cirrus/units/PressureUnit.java
// public enum PressureUnit {
//     HECTOPASCALS("Hectopascals (hPa)"),
//     INCHES_OF_MERCURY("Inches of Mercury (inHg)"),
//     KILIOPASCALS("Kilopascals (kPa)"),
//     MILLIBARS("Millibars (mb)"),
//     MILLIMETRES_OF_MERCURY("Millimetres of Mercury (mmHg)");
// 
//     private String description;
// 
//     PressureUnit(String description) {
//         this.description = description;
//     }
// 
//     public String toString() {
//         return description;
//     }
// }


import static java.math.MathContext.DECIMAL32;
import com.waynedgrant.cirrus.units.PressureUnit;
import java.math.BigDecimal;

/* Copyright 2017 Wayne D Grant (www.waynedgrant.com)
   Licensed under the MIT License */

package com.waynedgrant.cirrus.measures;




public class Pressure {
    private BigDecimal hectopascals;
    private BigDecimal millibars;
    private BigDecimal kilopascals;
    private BigDecimal inchesOfMercury;
    private BigDecimal millimetresOfMercury;

    public Pressure(BigDecimal hectopascals) {
        this.hectopascals = hectopascals;
        this.millibars = hectopascals;
        this.kilopascals = hectopascals.divide(new BigDecimal("10"), DECIMAL32);
        this.inchesOfMercury = hectopascals.multiply(new BigDecimal("0.02953"), DECIMAL32);
        this.millimetresOfMercury = hectopascals.multiply(new BigDecimal("0.750062"), DECIMAL32);
    }


// Path: app/src/main/java/com/waynedgrant/cirrus/units/PressureUnit.java
// public enum PressureUnit {
//     HECTOPASCALS("Hectopascals (hPa)"),
//     INCHES_OF_MERCURY("Inches of Mercury (inHg)"),
//     KILIOPASCALS("Kilopascals (kPa)"),
//     MILLIBARS("Millibars (mb)"),
//     MILLIMETRES_OF_MERCURY("Millimetres of Mercury (mmHg)");
// 
//     private String description;
// 
//     PressureUnit(String description) {
//         this.description = description;
//     }
// 
//     public String toString() {
//         return description;
//     }
// }


// Path: app/src/main/java/com/waynedgrant/cirrus/measures/Pressure.java
import static java.math.MathContext.DECIMAL32;
import com.waynedgrant.cirrus.units.PressureUnit;
import java.math.BigDecimal;

/* Copyright 2017 Wayne D Grant (www.waynedgrant.com)
   Licensed under the MIT License */

package com.waynedgrant.cirrus.measures;




public class Pressure {
    private BigDecimal hectopascals;
    private BigDecimal millibars;
    private BigDecimal kilopascals;
    private BigDecimal inchesOfMercury;
    private BigDecimal millimetresOfMercury;

    public Pressure(BigDecimal hectopascals) {
        this.hectopascals = hectopascals;
        this.millibars = hectopascals;
        this.kilopascals = hectopascals.divide(new BigDecimal("10"), DECIMAL32);
        this.inchesOfMercury = hectopascals.multiply(new BigDecimal("0.02953"), DECIMAL32);
        this.millimetresOfMercury = hectopascals.multiply(new BigDecimal("0.750062"), DECIMAL32);
    }


    public BigDecimal getValue(PressureUnit unit) {
