<commit_before>/*
 * Copyright (c) 2014 by Center Open Middleware. All Rights Reserved.
 * Titanium Appcelerator 3.2.0GA
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 *
 *   createNotification
 *      Parameters of visualization
 *      must have{
 *          message: {String},
 *      }
 *      optional{
 *          height: {Number}            -default = 100
 *          opacity: {Number}           -default = 1 [0 .. 1]
 *          borderColor: {String}       -default = #D3D3D3
 *          borderWidth: {Number}       -default = 1
 *          borderRadius: {Number}      -default = 5
 *          backgroundColor: {String}   -default = #E6E6E6
 *          fontSize: {Number}          -default = 16
 *          fontWeight: {String}        -default = normal ['bold', 'normal']
 *          textColor: {String}         -default = #000000
 *      }
 *      Return {String} JSON Information of Notification created
 */

"use strict";

var Notification = (function() {

    var _self = {};

    /** Private Function to Validate Toast Notification info
      *  @param: {Object} notification with notification info
      *  @return {Notification} notification info validated */
    var validateToastNotification = function validateToastNotification(notification) {
        var keys = {'backgroundColor' : '', 'borderColor' : '', 'borderRadius' : '',
        'borderWidth' : '', 'message' : '', 'opacity' : '', 'fontSize' : '', 'fontWeight' : '',
        'textColor' : '', 'duration' : ''}, key, temp;
        if(typeof notification.message === 'undefined'){
            notification.message = '[WARN] Key message should be defined';
            notification.validate = false;
        }
        else{
            temp = JSON.stringify(notification);
            notification.validate = true;
            for(key in JSON.parse(temp)){
                if(!keys.hasOwnProperty(key)){
                    notification[key] = '[WARN] Key '+key+' is not valid';
                    notification.validate = false;
                }
                else if((key === 'backgroundColor' || key === 'borderColor' ||
                key === 'message' || key === 'opacity' || key === 'textColor' ||
                key === 'duration') && typeof notification[key] !== 'string'){
                    notification[key] = '[WARN] Key '+key+' should be String';
                    notification.validate = false;
                }
                else if((key === 'borderWidth' || key === 'borderRadius' || key === 'fontSize' ||<commit_msg>[API.Notification] Add new annotations and delete old type comments<commit_after>/*
 * Copyright (c) 2014 by Center Open Middleware. All Rights Reserved.
 * Titanium Appcelerator 3.2.0GA
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */

/**
 * Toast notification.
 * @typedef {Object} Notification
 * @property {String} message
 * @property {Number} [height=100]
 * @property {Number} [opacity=1] 0 or 1
 * @property {String} [borderColor=#D3D3D3]
 * @property {Number} [borderWidth=1]
 * @property {Number} [borderRadius=5]
 * @property {String} [backgroundColor=#E6E6E6]
 * @property {Number} [fontSize=16]
 * @property {String} [fontWeight=normal] 'bold' or 'normal'
 * @property {String} [textColor=#000000]
 */

"use strict";

var Notification = (function() {

    /** It contains a method to manage notifications.
     * @author <NAME>
     * @version 1.0.0
     * @alias API.Notification
     * @namespace */
    var _self = {};

    /** Private Function to Validate Toast Notification info
      *  @param: {Object} notification with notification info
      *  @return {Notification} notification info validated */
    var validateToastNotification = function validateToastNotification(notification) {
        var keys = {'backgroundColor' : '', 'borderColor' : '', 'borderRadius' : '',
        'borderWidth' : '', 'message' : '', 'opacity' : '', 'fontSize' : '', 'fontWeight' : '',
        'textColor' : '', 'duration' : ''}, key, temp;
        if(typeof notification.message === 'undefined'){
            notification.message = '[WARN] Key message should be defined';
            notification.validate = false;
        }
        else{
            temp = JSON.stringify(notification);
            notification.validate = true;
            for(key in JSON.parse(temp)){
                if(!keys.hasOwnProperty(key)){
                    notification[key] = '[WARN] Key '+key+' is not valid';
                    notification.validate = false;
                }
                else if((key === 'backgroundColor' || key === 'borderColor' ||
                key === 'message' || key === 'opacity' || key === 'textColor' ||
                key === 'duration') && typeof notification[key] !== 'string'){
                    notification[key] = '[WARN] Key '+key+' should be String';
                    notification.validate = false;
                }
                else if((key === 'borderWidth' || key === 'borderRadius' || key === 'fontSize' ||
{'fraction_non_alphanumeric': 0.14060370009737097, 'fraction_numerical': 0.011879259980525803, 'mean_word_length': 2.3199741435035555, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2342421', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1301, 'n_words': 395}