// Generated by CoffeeScript 1.10.0
(function() {
  var iCalculator;

  iCalculator = (function() {

    /*
    @class iCalculator
    
    This serves as documentation for the interface expected of all Lumenize Calculators. You can extend from it but it's
    not technically necessary. You are more likely to copy this as the starting point for a new calculator.
     */
    function iCalculator(config) {
      this.config = config;

      /*
      @constructor
      @param {Object} config
        The config properties are up to you.
       */
      throw new Error('iCalculator is an interface not a base class. You must override this constructor.');
    }

    iCalculator.prototype.addSnapshots = function(snapshots, startOn, endBefore) {

      /*
      @method addSnapshots
        Allows you to incrementally add snapshots to this calculator.
      @chainable
      @param {Object[]} snapshots An array of temporal data model snapshots.
      @param {String} startOn A ISOString (e.g. '2012-01-01T12:34:56.789Z') indicating the time start of the period of
        interest. On the second through nth call, this should equal the previous endBefore.
      @param {String} endBefore A ISOString (e.g. '2012-01-01T12:34:56.789Z') indicating the moment just past the time
        period of interest.
      @return {iCalculator}
       */
      throw new Error('iCalculator is an interface not a base class. You must override this addSnapshots method.');
      if (this.upToDateISOString != null) {
        utils.assert(this.upToDateISOString === startOn, "startOn (" + startOn + ") parameter should equal endBefore of previous call (" + this.upToDateISOString + ") to addSnapshots.");
      }
      this.upToDateISOString = endBefore;
      return this;
    };

    iCalculator.prototype.getResults = function() {

      /*
      @method getResults
        Returns the current state of the calculator
      @return {Object} The type and format of what it returns is up to you.
       */
      throw new Error('iCalculator is an interface not a base class. You must override this getResults method.');
    };

    iCalculator.prototype.getStateForSaving = function(meta) {

      /*
      @method getStateForSaving
        Enables saving the state of this calculator. See TimeInStateCalculator for a detailed example.
      @param {Object} [meta] An optional parameter that will be added to the serialized output and added to the meta field
        within the deserialized calculator.
      @return {Object} Returns an Ojbect representing the state of the calculator. This Object is suitable for saving to
        to an object store or LocalCache. Use the static method `newFromSavedState()` with this Object as the parameter to reconstitute
        the calculator.
       */
      var out;
      throw new Error('iCalculator is an interface not a base class. You must override this getStateForSaving method.');
      out = {};
      out.upToDateISOString = this.upToDateISOString;
      if (meta != null) {
        out.meta = meta;
      }
      return out;
    };

    iCalculator.newFromSavedState = function(p) {

      /*
      @method newFromSavedState
        Deserializes a previously saved calculator and returns a new calculator. See TimeInStateCalculator for a detailed example.
      @static
      @param {String/Object} p A String or Object from a previously saved calculator state
      @return {iCalculator}
       */
      throw new Error('iCalculator is an interface not a base class. You must override this @newFromSavedState method.');
      if (utils.type(p) === 'string') {
        p = JSON.parse(p);
      }
      if (p.meta != null) {
        calculator.meta = p.meta;
      }
      calculator.upToDateISOString = p.upToDateISOString;
      return calculator;
    };

    return iCalculator;

  })();

  exports.iCalculator = iCalculator;

}).call(this);
