text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  var _TransformFormat = require('../../transform/TransformFormat');
  
  var _TransformFormat2 = _interopRequireDefault(_TransformFormat);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  /**
   * Provides several helper methods to work with method oriented data stored as `this.methodAggregate` in `ClassReport` /
   * `ModuleReport` and directly in `ClassMethodReport` / `ModuleMethodReport`.
   */
  var AbstractReport = function () {
    /**
     * If given assigns the method report to an internal variable. This is used by `ClassReport` and `ModuleReport`
     * which stores a `AggregateMethodReport` respectively in `this.methodAggregate`.
     *
     * @param {AggregateMethodReport}   aggregateMethodReport - An AggregateMethodReport to associate with this report.
     */
    function AbstractReport() {
      var aggregateMethodReport = arguments.length <= 0 || arguments[0] === undefined ? void 0 : arguments[0];
  
      _classCallCheck(this, AbstractReport);
  
      /**
       * Stores any associated `AggregateMethodReport`.
       * @type {AggregateMethodReport}
       */
      this.methodAggregate = aggregateMethodReport;
    }
  
    /**
     * Returns the associated `AggregateMethodReport` or `this`. Both ClassReport and ModuleReport have an
     * `methodAggregate` AggregateMethodReport.
     *
     * @returns {AggregateMethodReport}
     */
  
  
    _createClass(AbstractReport, [{
      key: 'incrementDistinctHalsteadItems',
  
  
      /**
       * Increments the associated aggregate report HalsteadData for distinct identifiers.
       *
       * @param {string}   metric - A Halstead metric name.
       * @param {string}   identifier - A Halstead identifier name.
       */
      value: function incrementDistinctHalsteadItems(metric, identifier) {
        if (this.isHalsteadMetricDistinct(metric, identifier)) {
          this.aggregateMethodReport.halstead[metric].identifiers.push(identifier);
  
          this.incrementHalsteadMetric(metric, 'distinct');
        }
      }
  
      /**
       * Increments the associated aggregate report Halstead items including distinct and total counts.
       *
       * @param {string}   metric - A Halstead metric name.
       * @param {string}   identifier - A Halstead identifier name.
       */
  
    }, {
      key: 'incrementHalsteadItems',
      value: function incrementHalsteadItems(metric, identifier) {
        this.incrementDistinctHalsteadItems(metric, identifier);
  
        // Increment total halstead items
        this.incrementHalsteadMetric(metric, 'total');
      }
  
      /**
       * Increments the associated aggregate report Halstead metric type.
       *
       * @param {string}   metric - A Halstead metric name.
       * @param {string}   type - A Halstead metric type.
       */
  
    }, {
      key: 'incrementHalsteadMetric',
      value: function incrementHalsteadMetric(metric, type) {
        this.aggregateMethodReport.halstead[metric][type] += 1;
      }
  
      /**
       * Increments the associated aggregate report parameter count.
       *
       * @param {number}   count - Value to increase params by.
       */
  
    }, {
      key: 'incrementParams',
      value: function incrementParams(count) {
        this.aggregateMethodReport.params += count;
      }
  
      /**
       * Returns true if a given HalsteadData metric / identifier is not found in the associated aggregate report.
       *
       * @param {string}   metric - A Halstead metric name.
       * @param {string}   identifier - A Halstead identifier name.
       *
       * @returns {boolean}
       */
  
    }, {
      key: 'isHalsteadMetricDistinct',
      value: function isHalsteadMetricDistinct(metric, identifier) {
        return this.aggregateMethodReport.halstead[metric].identifiers.indexOf(identifier) === -1;
      }
  
      /**
       * Formats this report given the type.
       *
       * @param {string}   name - The name of formatter to use.
       *
       * @param {object}   options - (Optional) One or more optional parameters to pass to the formatter.
       *
       * @returns {string}
       */
  
    }, {
      key: 'toFormat',
      value: function toFormat(name) {
        var options = arguments.length <= 1 || arguments[1] === undefined ? void 0 : arguments[1];
  
        return _TransformFormat2.default.format(this, name, options);
      }
    }, {
      key: 'aggregateMethodReport',
      get: function get() {
        return typeof this.methodAggregate !== 'undefined' ? this.methodAggregate : this;
      }
    }]);
  
    return AbstractReport;
  }();
  
  exports.default = AbstractReport;
  module.exports = exports['default'];