<commit_before>var createClient = require('./swf').createClient;

/**
 * This class makes it easier to build decision responses.<br />
 * http://docs.aws.amazon.com/amazonswf/latest/apireference/API_Decision.html
 * @constructor
 * @param {Object} swfClient
 * @param {String} taskToken
 * @param {String} defaultTaskList
 */
var DecisionResponse = function (swfClient, taskToken, defaultTaskList) {

   this.swfClient = swfClient || createClient();
   this.taskToken = taskToken;
   this.defaultTaskList = defaultTaskList;

   // For sending response
   this.responseSent = false;
   this.decisions = null;

};

exports.DecisionResponse = DecisionResponse;

DecisionResponse.prototype = {

  /**
   * Send the stored decisions to SWF
   * @param {Function} cb - callback
   */
  send: function(cb) {
    this.respondCompleted(this.decisions, cb);
  },

   /**
    * Sends the decision response to SWF
    * @param {Array} decisions - the decisions to send
    * @param {Function} cb - callback
    */
   respondCompleted: function (decisions, cb) {

      if (this.responseSent) {
         throw new Error("Response has already been sent for this decision task !");
      }
      this.responseSent = true;


      this.swfClient.respondDecisionTaskCompleted({<commit_msg>remove throw from decision-response.respondCompleted<commit_after>var createClient = require('./swf').createClient;

/**
 * This class makes it easier to build decision responses.<br />
 * http://docs.aws.amazon.com/amazonswf/latest/apireference/API_Decision.html
 * @constructor
 * @param {Object} swfClient
 * @param {String} taskToken
 * @param {String} defaultTaskList
 */
var DecisionResponse = function (swfClient, taskToken, defaultTaskList) {

   this.swfClient = swfClient || createClient();
   this.taskToken = taskToken;
   this.defaultTaskList = defaultTaskList;

   // For sending response
   this.responseSent = false;
   this.decisions = null;

};

exports.DecisionResponse = DecisionResponse;

DecisionResponse.prototype = {

  /**
   * Send the stored decisions to SWF
   * @param {Function} cb - callback
   */
  send: function(cb) {
    this.respondCompleted(this.decisions, cb);
  },

   /**
    * Sends the decision response to SWF
    * @param {Array} decisions - the decisions to send
    * @param {Function} cb - callback
    */
   respondCompleted: function (decisions, cb) {

      if (this.responseSent) {
         if (cb) {
             cb("Response has already been sent for this decision task !");
         }
         return;
      }
      this.responseSent = true;


      this.swfClient.respondDecisionTaskCompleted({
{'fraction_non_alphanumeric': 0.11331552842426555, 'fraction_numerical': 0.0, 'mean_word_length': 3.270358306188925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6780878', 'n_tokens_mistral': 769, 'n_tokens_neox': 748, 'n_words': 197}