Source: chemistry/SolventConcentrationSolutionModeler.js

/**
 * This module manages the solvent concentration modeling approach for the solution.
 * It handles whether the solvent (typically water) is treated as finite or infinite 
 * in calculations.
 * 
 * @module SolventConcentrationSolutionModeler
 * @description Defines how solvent concentration is modeled in solution calculations.
 * When set to SOLVENTINFINITE (default), the model assumes that the solvent has an effectively
 * infinite amount and uses water replacement factors for property calculations.
 * When set to SOLVENTFINITE, the model treats the solvent as having a specific finite
 * amount which affects all solution property calculations.
 * 
 * @property {number} SOLVENTINFINITE - Model treating solvent as infinite (0, Default)
 * @property {number} SOLVENTFINITE - Model treating solvent as finite (1)
 * @property {number} simulationModel - The currently active simulation model (0 or 1)
 * 
 */
define(function () {
    var instance = null;
    /**
     * Models the Solvent Concentration
     * @class
     */
    function SolventConcentrationSolutionModeler () {
        // The default model used when no other model is selected
        this.DEFAULT = 0;

        // the SOLVENTINFINITE model assumes that water is always considered having
        // an amount of substance equal to infinite. Then the calculation of the
        // properties relies on the waterReplacement factor in order to discount the
        // water and get a reliable value.
        this.WATERINFINITE = 0;
        this.SOLVENTINFINITE = 0;

        // The SOLVENTFINITE model assumes that the amount of water is properly set
        // in all solutions and then the property is evaluated adding the ponderated
        // properties for all the substances.
        //
        // All species with infinite amount are assumed ficticious and with no mass.
        this.WATERFINITE = 1;
        this.SOLVENTFINITE = 1;

        // Stores the simulation model being used
        this.simulationModel = this.DEFAULT;
    };

    /**
     * Resets the default status
     */
    SolventConcentrationSolutionModeler.prototype.setDefault = function () {
        this.simulationModel = this.DEFAULT;
    };

    /**
     * Load the characteristics of the model from the problem file
     * @param model value of solutionModellers.waterConcentration or .solventConcentration from configuration
     */
    SolventConcentrationSolutionModeler.prototype.loadProperties = function (model) {
        if (model.toUpperCase() === "WATERINFINITE" || model.toUpperCase() === "SOLVENTINFINITE")
            this.simulationModel = this.SOLVENTINFINITE;
        else if (model.toUpperCase() === "WATERFINITE" || model.toUpperCase() === "SOLVENTFINITE")
            this.simulationModel = this.SOLVENTFINITE;
    };

    SolventConcentrationSolutionModeler.getInstance = function() {
        if(instance === null) {
            instance = new SolventConcentrationSolutionModeler();
        }
        return instance;
    };
    return SolventConcentrationSolutionModeler.getInstance();
});