else { float afterRemovalCO2 = randomFilter(CO2Moles - ((CO2Moles / getTotalMoles()) * molesRequested)); float afterRemovalO2 = randomFilter(O2Moles - ((O2Moles / getTotalMoles()) * molesRequested)); float afterRemovalOther = randomFilter(otherMoles - ((otherMoles / getTotalMoles()) * molesRequested)); float afterRemovalWater = randomFilter(waterMoles - ((waterMoles / getTotalMoles()) * molesRequested)); float afterRemovalNitrogen = randomFilter(nitrogenMoles - ((nitrogenMoles / getTotalMoles()) * molesRequested)); float O2MolesTaken = O2Moles - afterRemovalO2; float CO2MolesTaken = CO2Moles - afterRemovalCO2; float otherMolesTaken = otherMoles - afterRemovalOther; float waterMolesTaken = waterMoles - afterRemovalWater; float nitrogenMolesTaken = nitrogenMoles - afterRemovalNitrogen; O2Moles = afterRemovalO2; CO2Moles = afterRemovalCO2; otherMoles = afterRemovalOther; waterMoles = afterRemovalWater; nitrogenMoles = afterRemovalNitrogen; return new Breath(O2MolesTaken, CO2MolesTaken, waterMolesTaken, otherMolesTaken, nitrogenMolesTaken); }
float afterRemovalCO2 = randomFilter(CO2Moles - ((CO2Moles / getTotalMoles()) * molesRequested)); float afterRemovalO2 = randomFilter(O2Moles - ((O2Moles / getTotalMoles()) * molesRequested)); float afterRemovalOther = randomFilter(otherMoles - ((otherMoles / getTotalMoles()) * molesRequested)); float afterRemovalWater = randomFilter(waterMoles - ((waterMoles / getTotalMoles()) * molesRequested)); float afterRemovalNitrogen = randomFilter(nitrogenMoles - ((nitrogenMoles / getTotalMoles()) * molesRequested)); float O2MolesTaken = O2Moles - afterRemovalO2; float CO2MolesTaken = CO2Moles - afterRemovalCO2; float otherMolesTaken = otherMoles - afterRemovalOther; float waterMolesTaken = waterMoles - afterRemovalWater; float nitrogenMolesTaken = nitrogenMoles - afterRemovalNitrogen; O2Moles = afterRemovalO2; CO2Moles = afterRemovalCO2; otherMoles = afterRemovalOther; waterMoles = afterRemovalWater; nitrogenMoles = afterRemovalNitrogen; return new Breath(O2MolesTaken, CO2MolesTaken, waterMolesTaken, otherMolesTaken, nitrogenMolesTaken);
    public Breath takeAirMoles(float molesRequested) {        //idiot check        if (Float.isNaN(molesRequested)) {            myLogger.warn("in takeAirMoles, attemped to remove "                    + molesRequested);            return new Breath(0f, 0f, 0f, 0f, 0f);        }        if (molesRequested <= 0)            return new Breath(0f, 0f, 0f, 0f, 0f);        //asking for more gas than exists        if (molesRequested >= getTotalMoles()) {            float afterRemovalCO2 = randomFilter(CO2Moles);            float afterRemovalO2 = randomFilter(O2Moles);            float afterRemovalOther = randomFilter(otherMoles);            float afterRemovalWater = randomFilter(waterMoles);            float afterRemovalNitrogen = randomFilter(nitrogenMoles);            setTotalMoles(0);            return new Breath(afterRemovalO2, afterRemovalCO2,                    afterRemovalWater, afterRemovalOther, afterRemovalNitrogen);        }        //gas exists for request        //MESSED UP!        else {            float afterRemovalCO2 = randomFilter(CO2Moles                    - ((CO2Moles / getTotalMoles()) * molesRequested));            float afterRemovalO2 = randomFilter(O2Moles                    - ((O2Moles / getTotalMoles()) * molesRequested));            float afterRemovalOther = randomFilter(otherMoles                    - ((otherMoles / getTotalMoles()) * molesRequested));            float afterRemovalWater = randomFilter(waterMoles                    - ((waterMoles / getTotalMoles()) * molesRequested));            float afterRemovalNitrogen = randomFilter(nitrogenMoles                    - ((nitrogenMoles / getTotalMoles()) * molesRequested));            float O2MolesTaken = O2Moles - afterRemovalO2;            float CO2MolesTaken = CO2Moles - afterRemovalCO2;            float otherMolesTaken = otherMoles - afterRemovalOther;            float waterMolesTaken = waterMoles - afterRemovalWater;            float nitrogenMolesTaken = nitrogenMoles - afterRemovalNitrogen;            O2Moles = afterRemovalO2;            CO2Moles = afterRemovalCO2;            otherMoles = afterRemovalOther;            waterMoles = afterRemovalWater;            nitrogenMoles = afterRemovalNitrogen;            return new Breath(O2MolesTaken, CO2MolesTaken, waterMolesTaken,                    otherMolesTaken, nitrogenMolesTaken);        }    }