Code coverage report for Model/GraphsModel/Axis.js

Statements: 100% (51 / 51)      Branches: 71.43% (20 / 28)      Functions: 90.91% (10 / 11)      Lines: 100% (51 / 51)      Ignored: none     

All files » Model/GraphsModel/ » Axis.js
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113                                                    1       1   56 56 56 56 56 56     56 43 43   43 7   43 7   43 7   43 8   43 7           110 6 6 6   6 6   6 6   6 6   6 6   6 6         110 15   110 3   110 3   110 3   110 4   110 3       1   110 56   110  
/*jshint node: true */
'use strict';
 
/*
* Name :  Axis.js
* Module : FrontEnd::Model::GraphsModel
* Location : /frontend/app/Model/GraphsModel
*
* History :
* Version       Date        Programmer                  Description
* ===============================================================================================================
* 1.0.0         2015-05-21  Maria Giovanna Chinellato   Tested
*
* 0.1.3         2015-05-18  Maria Giovanna Chinellato   Fix attributes
*
* 0.1.2         2015-05-17  Maria Giovanna Chinellato   Fix code
*
* 0.1.1         2015-05-15  Francesco Rossetto          Fix attributes and methods
*
* 0.1.0         2015-05-14  Maria Giovanna Chinellato   Add attributes and methods
*
* 0.0.1         2015-05-14  Maria Giovanna Chinellato   Initial code      
* ===============================================================================================================
*
*/
 
angular.module('norris-nrti')
.factory('AxisFactory', function(){
 
    // costruttore di Axis
    function Axis(info){
        // campi dati di axis e valori di default
        this._name = null;
        this._color = '#FFF';
        this._minValue = null;
        this._maxValue = null;
        this._ticks = 10;
        this._scale = 'linear';
 
        // controlla se ci sono dei campi dati da impostare, altrimenti crea un asse di default
        if (info !== undefined) {
            Eif (info.name !== undefined) {
                this._name = info.name;
            }
            if (info.color !== undefined) {
                this._color = info.color;
            }
            if (info.minIndex !== undefined) {
                this._minValue = info.minIndex;
            }
            if (info.maxIndex !== undefined) {
                this._maxValue = info.maxIndex;
            }
            if (info.ticks !== undefined) {
                this._ticks = info.ticks;
            }
            if (info.scale !== undefined) {
                this._scale = info.scale;
            }
        }
    }
 
    // funzine che aggiorna i campi dati di un asse
    Axis.prototype.updateParameters = function(info){
        Eif (info !== undefined) {
            Eif (info.name !== undefined) {
                this._name = info.name;
            }
            Eif (info.color !== undefined) {
                this._color = info.color;
            }
            Eif (info.minIndex !== undefined) {
                this._minValue = info.minIndex;
            }
            Eif (info.maxIndex !== undefined) {
                this._maxValue = info.maxIndex;
            }
            Eif (info.ticks !== undefined) {
                this._ticks = info.ticks;
            }
            Eif (info.scale !== undefined) {
                this._scale = info.scale;
            }
        }
    };
 
    Axis.prototype.getName = function(){
        return this._name; // ritorna il nome dell'asse
    };
    Axis.prototype.getColor = function(){
        return this._color; // ritona il colore dell'asse
    };
    Axis.prototype.getMinValue = function(){
        return this._minValue; // ritorna il minimo valore dell'asse
    };
    Axis.prototype.getMaxValue = function(){
        return this._maxValue; // ritorna il massimo valore dell'asse
    };
    Axis.prototype.getTicks = function(){
        return this._ticks; // ritorna il valore dei tick
    };
    Axis.prototype.getScale = function(){
        return this._scale; // ritorna la scale dell'asse
    };
 
    // costruttore di default di AxisFactory
    function AxisFactory() {}
 
    AxisFactory.build = function(info) {
        return new Axis(info); // ritorna l'istanza di un nuovo asse
    };
    return( AxisFactory );
});