'use strict'

//non steady state box models
const NonSteadyState = {
  state(props) {
    if (!props) return this
    else return Object.assign(Object.create(this), props)
  },
  update(props) {
    if (props) {
      for (let key in props) {
        if (this.hasOwnProperty(key)) {
          this[key] = props[key]
        } else throw 'Property "' + key + '" does not exist.'
      }
    }
    return this
  },
  flowAt(time) {
    let currentFlow = this.flow
    currentFlow += (this.deltaFlow * time)
    return currentFlow
  },
  stockAt(time) {
    let currentStock = this.stock
    currentStock += (this.flow * time)
    return currentStock
  }
}

module.exports = NonSteadyState

@@ -454,16 +454,58 @@
 his.flow
+ %7C%7C 0,%0A    deltaFlow = this.deltaFlow %7C%7C 0
 %0A    cur
@@ -517,21 +517,16 @@
 low += (
-this.
 deltaFlo
@@ -614,16 +614,21 @@
 is.stock
+ %7C%7C 0
 %0A    cur
@@ -650,16 +650,24 @@
 his.flow
+At(time)
  * time)

allow zero values for properties