All files / src/Formats/XLS/LocationUtilityService/model Preference.js

93.33% Statements 14/15
50% Branches 1/2
100% Functions 2/2
93.33% Lines 14/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82                                            6x 6x   6x               6x           1x                                                       1x 6x 6x 6x 11x 11x 11x     6x 6x        
import Logger from "../../../../Utils/LoggerByDefault";
 
/**
 * @classdesc
 *
 * Preference (Reverse)
 *
 * FIXME liste des types de tables de geocodage
 *
 * ```
 * template : "<ReverseGeocodePreference>__TYPE__</ReverseGeocodePreference>"
 * ```
 *
 * @constructor
 * @alias Gp.Formats.XLS.LocationUtilityService.Preference
 * @param {String} type - type de table de geocodage
 *
 * @private
 *
 */
 
function Preference (type) {
    this.logger = Logger.getLogger("Preference");
    this.logger.trace("[Constructeur Preference ()]");
 
    Iif (!(this instanceof Preference)) {
        throw new TypeError("Preference constructor cannot be called as a function.");
    }
 
    /**
     * type de table de geocodage
     * @type {Array.<String>}
     */
    this.type = type;
}
 
/**
 * @lends module:Preference#
 */
Preference.prototype = {
 
    /**
     * Constructeur (alias)
     */
    constructor : Preference,
 
    /**
     * request (out)
     * @type {String}
     */
    requestString : null,
 
    /**
     * Template de la requête.
     *
     * substitution des valeurs suivantes :
     *  __TYPE__
     *
     */
    template : "<ReverseGeocodePreference>__TYPE__</ReverseGeocodePreference>"
};
 
/**
 * toString
 *
 * @returns {String} requête
 */
Preference.prototype.toString = function () {
    var Preferences = [];
    var tmplPreference = "";
    for (var idx = 0; idx < this.type.length; idx++) {
        tmplPreference = this.template;
        tmplPreference = tmplPreference.replace(/__TYPE__/g, this.type[idx]);
        Preferences.push(tmplPreference);
    }
 
    this.strRequest = Preferences.join("\n");
    return this.strRequest;
};
 
export default Preference;