UNPKG

lumenize

Version:

Illuminating the forest AND the trees in your data.

1 lines 24.6 kB
Ext.data.JsonP.Lumenize_TimeInStateCalculator({"tagname":"class","name":"Lumenize.TimeInStateCalculator","autodetected":{},"files":[{"filename":"TimeInStateCalculator.coffee.js","href":"TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator"}],"members":[{"name":"granularity","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-granularity","meta":{}},{"name":"holidays","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-holidays","meta":{}},{"name":"trackLastValueForTheseFields","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-trackLastValueForTheseFields","meta":{}},{"name":"tz","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-tz","meta":{}},{"name":"uniqueIDField","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-uniqueIDField","meta":{}},{"name":"validFromField","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-validFromField","meta":{}},{"name":"validToField","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-validToField","meta":{}},{"name":"workDayEndBefore","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-workDayEndBefore","meta":{}},{"name":"workDayStartOn","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-workDayStartOn","meta":{}},{"name":"workDays","tagname":"cfg","owner":"Lumenize.TimeInStateCalculator","id":"cfg-workDays","meta":{}},{"name":"constructor","tagname":"method","owner":"Lumenize.TimeInStateCalculator","id":"method-constructor","meta":{}},{"name":"addSnapshots","tagname":"method","owner":"Lumenize.TimeInStateCalculator","id":"method-addSnapshots","meta":{"chainable":true}},{"name":"getResults","tagname":"method","owner":"Lumenize.TimeInStateCalculator","id":"method-getResults","meta":{}},{"name":"getStateForSaving","tagname":"method","owner":"Lumenize.TimeInStateCalculator","id":"method-getStateForSaving","meta":{}},{"name":"newFromSavedState","tagname":"method","owner":"Lumenize.TimeInStateCalculator","id":"static-method-newFromSavedState","meta":{"static":true}}],"alternateClassNames":[],"aliases":{},"id":"class-Lumenize.TimeInStateCalculator","short_doc":"Used to calculate how much time each uniqueID spent \"in-state\". ...","component":false,"superclasses":[],"subclasses":[],"mixedInto":[],"mixins":[],"parentMixins":[],"requires":[],"uses":[],"html":"<div><pre class=\"hierarchy\"><h4>Files</h4><div class='dependency'><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator' target='_blank'>TimeInStateCalculator.coffee.js</a></div></pre><div class='doc-contents'><p>Used to calculate how much time each uniqueID spent \"in-state\". You use this by querying a temporal data\nmodel (like Rally's Lookback API) with a predicate indicating the \"state\" of interest. You'll then have a list of\nsnapshots where that predicate was true. You pass this in to the addSnapshots method of this previously instantiated\nTimeInStateCalculator class.</p>\n\n<p>Usage:</p>\n\n<pre><code>{TimeInStateCalculator} = require('../')\n\nsnapshots = [ \n { id: 1, from: '2011-01-06T15:10:00.000Z', to: '2011-01-06T15:30:00.000Z', Name: 'Item A' }, # 20 minutes all within an hour\n { id: 2, from: '2011-01-06T15:50:00.000Z', to: '2011-01-06T16:10:00.000Z', Name: 'Item B' }, # 20 minutes spanning an hour\n { id: 3, from: '2011-01-07T13:00:00.000Z', to: '2011-01-07T15:20:00.000Z', Name: 'Item C' }, # start 2 hours before but overlap by 20 minutes of start\n { id: 4, from: '2011-01-06T16:40:00.000Z', to: '2011-01-06T19:00:00.000Z', Name: 'Item D' }, # 20 minutes before end of day\n { id: 5, from: '2011-01-06T16:50:00.000Z', to: '2011-01-07T15:10:00.000Z', Name: 'Item E' }, # 10 minutes before end of one day and 10 before the start of next\n { id: 6, from: '2011-01-06T16:55:00.000Z', to: '2011-01-07T15:05:00.000Z', Name: 'Item F' }, # multiple cycles over several days for a total of 20 minutes of work time\n { id: 6, from: '2011-01-07T16:55:00.000Z', to: '2011-01-10T15:05:00.000Z', Name: 'Item F modified' },\n { id: 7, from: '2011-01-06T16:40:00.000Z', to: '9999-01-01T00:00:00.000Z', Name: 'Item G' } # continues past the range of consideration in this test\n]\n\ngranularity = 'minute'\ntz = 'America/Chicago'\n\nconfig = # default work days and holidays\n granularity: granularity\n tz: tz\n endBefore: '2011-01-11T00:00:00.000'\n workDayStartOn: {hour: 9, minute: 0} # 09:00 in Chicago is 15:00 in GMT\n workDayEndBefore: {hour: 11, minute: 0} # 11:00 in Chicago is 17:00 in GMT # !TODO: Change this to 5pm when I change the samples above\n validFromField: 'from'\n validToField: 'to'\n uniqueIDField: 'id'\n trackLastValueForTheseFields: ['to', 'Name']\n\nstartOn = '2011-01-05T00:00:00.000Z'\nendBefore = '2011-01-11T00:00:00.000Z'\n\ntisc = new TimeInStateCalculator(config)\ntisc.addSnapshots(snapshots, startOn, endBefore)\n\nconsole.log(tisc.getResults())\n# [ { id: 1,\n# ticks: 20,\n# to_lastValue: '2011-01-06T15:30:00.000Z',\n# Name_lastValue: 'Item A' },\n# { id: 2,\n# ticks: 20,\n# to_lastValue: '2011-01-06T16:10:00.000Z',\n# Name_lastValue: 'Item B' },\n# { id: 3,\n# ticks: 20,\n# to_lastValue: '2011-01-07T15:20:00.000Z',\n# Name_lastValue: 'Item C' },\n# { id: 4,\n# ticks: 20,\n# to_lastValue: '2011-01-06T19:00:00.000Z',\n# Name_lastValue: 'Item D' },\n# { id: 5,\n# ticks: 20,\n# to_lastValue: '2011-01-07T15:10:00.000Z',\n# Name_lastValue: 'Item E' },\n# { id: 6,\n# ticks: 20,\n# to_lastValue: '2011-01-10T15:05:00.000Z',\n# Name_lastValue: 'Item F modified' },\n# { id: 7,\n# ticks: 260,\n# to_lastValue: '9999-01-01T00:00:00.000Z',\n# Name_lastValue: 'Item G' } ]\n</code></pre>\n\n<p>But we are not done yet. We can serialize the state of this calculator and later restore it.</p>\n\n<pre><code>savedState = tisc.getStateForSaving({somekey: 'some value'})\n</code></pre>\n\n<p>Let's incrementally update the original.</p>\n\n<pre><code>snapshots = [\n { id: 7, from: '2011-01-06T16:40:00.000Z', to: '9999-01-01T00:00:00.000Z', Name: 'Item G modified' }, # same snapshot as before still going\n { id: 3, from: '2011-01-11T15:00:00.000Z', to: '2011-01-11T15:20:00.000Z', Name: 'Item C modified' }, # 20 more minutes for id 3\n { id: 8, from: '2011-01-11T15:00:00.000Z', to: '9999-01-01T00:00:00.000Z', Name: 'Item H' } # 20 minutes in scope for new id 8\n]\n\nstartOn = '2011-01-11T00:00:00.000Z' # must match endBefore of prior call\nendBefore = '2011-01-11T15:20:00.000Z'\n\ntisc.addSnapshots(snapshots, startOn, endBefore)\n</code></pre>\n\n<p>Now, let's restore from saved state into tisc2 and give it the same updates and confirm that they match.</p>\n\n<pre><code>tisc2 = TimeInStateCalculator.newFromSavedState(savedState)\ntisc2.addSnapshots(snapshots, startOn, endBefore)\n\nconsole.log(tisc2.meta.somekey)\n# some value\n\nconsole.log(JSON.stringify(tisc.getResults()) == JSON.stringify(tisc2.getResults()))\n# true\n</code></pre>\n\n<p>Note, it's common to calculate time in state at granularity of hour and convert it to fractional days. Since it knocks\nout non-work hours, this conversion is not as simple as dividing by 24. This code calculates the conversion factor\n(workHours) for whatever workDayStartOn and workDayEndBefore you have specified even if your \"workday\" spans midnight.</p>\n\n<pre><code>startOnInMinutes = config.workDayStartOn.hour * 60\nif config.workDayStartOn?.minute\n startOnInMinutes += config.workDayStartOn.minute\nendBeforeInMinutes = config.workDayEndBefore.hour * 60\nif config.workDayEndBefore?.minute\n endBeforeInMinutes += config.workDayEndBefore.minute\nif startOnInMinutes &lt; endBeforeInMinutes\n workMinutes = endBeforeInMinutes - startOnInMinutes\nelse\n workMinutes = 24 * 60 - startOnInMinutes\n workMinutes += endBeforeInMinutes\nworkHours = workMinutes / 60\n\nconsole.log(workHours) # Should say 2 because our work day was from 9am to 11am\n# 2\n</code></pre>\n\n<p>You would simply divide the ticks by this <code>workHours</code> value to convert from ticks (in hours) to fractional days.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-cfg'>Config options</h3><div class='subsection'><div id='cfg-granularity' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-granularity' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-granularity' class='name expandable'>granularity</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'>This calculator will tell you how many ticks fall within the snapshots you feed in. ...</div><div class='long'><p>This calculator will tell you how many ticks fall within the snapshots you feed in.\n This configuration value indicates the granularity of the ticks (i.e. Time.MINUTE, Time.HOUR, Time.DAY, etc.)</p>\n</div></div></div><div id='cfg-holidays' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-holidays' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-holidays' class='name expandable'>holidays</a> : Object[]<span class=\"signature\"></span></div><div class='description'><div class='short'>An optional Array containing rows that are either ISOStrings or JavaScript Objects\n (mix and match). ...</div><div class='long'><p>An optional Array containing rows that are either ISOStrings or JavaScript Objects\n (mix and match). Example: <code>[{month: 12, day: 25}, {year: 2011, month: 11, day: 24}, \"2012-12-24\"]</code>\n Notice how you can leave off the year if the holiday falls on the same day every year.</p>\n</div></div></div><div id='cfg-trackLastValueForTheseFields' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-trackLastValueForTheseFields' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-trackLastValueForTheseFields' class='name expandable'>trackLastValueForTheseFields</a> : String[]<span class=\"signature\"></span></div><div class='description'><div class='short'>If provided, the last value of these fields will appear in the results. ...</div><div class='long'><p>If provided, the last value of these fields will appear in the results.\n This is useful if you want to filter the result by where the ended or if you want information to fill in the tooltip\n for a chart.</p>\n</div></div></div><div id='cfg-tz' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-tz' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-tz' class='name expandable'>tz</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'><p>The timezone for analysis</p>\n</div><div class='long'><p>The timezone for analysis</p>\n</div></div></div><div id='cfg-uniqueIDField' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-uniqueIDField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-uniqueIDField' class='name expandable'>uniqueIDField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>&quot;_EntityID&quot;</code></p></div></div></div><div id='cfg-validFromField' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-validFromField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-validFromField' class='name expandable'>validFromField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>&quot;_ValidFrom&quot;</code></p></div></div></div><div id='cfg-validToField' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-validToField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-validToField' class='name expandable'>validToField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>&quot;_ValidTo&quot;</code></p></div></div></div><div id='cfg-workDayEndBefore' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-workDayEndBefore' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-workDayEndBefore' class='name expandable'>workDayEndBefore</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>An optional object in the form {hour: 17, minute: 0}. ...</div><div class='long'><p>An optional object in the form {hour: 17, minute: 0}. If minute is zero it can be omitted.\n The use of workDayStartOn and workDayEndBefore only make sense when the granularity is \"hour\" or finer.\n Note: If the business closes at 5:00pm, you'll want to leave workDayEndBefore to 17:00, rather\n than 17:01. Think about it, you'll be open 4:59:59.999pm, but you'll be closed at 5:00pm. This also makes all of\n the math work. 9am to 5pm means 17 - 9 = an 8 hour work day.</p>\n</div></div></div><div id='cfg-workDayStartOn' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-workDayStartOn' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-workDayStartOn' class='name expandable'>workDayStartOn</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>An optional object in the form {hour: 8, minute: 15}. ...</div><div class='long'><p>An optional object in the form {hour: 8, minute: 15}. If minute is zero it can be omitted.\n If workDayStartOn is later than workDayEndBefore, then it assumes that you work the night shift and your work\n hours span midnight. If tickGranularity is \"hour\" or finer, you probably want to set this; if tickGranularity is\n \"day\" or coarser, probably not.</p>\n</div></div></div><div id='cfg-workDays' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-cfg-workDays' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-cfg-workDays' class='name expandable'>workDays</a> : String[]/String<span class=\"signature\"></span></div><div class='description'><div class='short'>List of days of the week that you work on. ...</div><div class='long'><p>List of days of the week that you work on. You can specify this as an Array of Strings\n (['Monday', 'Tuesday', ...]) or a single comma seperated String (\"Monday,Tuesday,...\").</p>\n<p>Defaults to: <code>[&#39;Monday&#39;, &#39;Tuesday&#39;, &#39;Wednesday&#39;, &#39;Thursday&#39;, &#39;Friday&#39;]</code></p></div></div></div></div></div><div class='members-section'><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div class='definedBy'>Defined By</div><h4 class='members-subtitle'>Instance methods</h3><div id='method-constructor' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-method-constructor' target='_blank' class='view-source'>view source</a></div><strong class='new-keyword'>new</strong><a href='#!/api/Lumenize.TimeInStateCalculator-method-constructor' class='name expandable'>Lumenize.TimeInStateCalculator</a>( <span class='pre'>config</span> ) : <a href=\"#!/api/Lumenize.TimeInStateCalculator\" rel=\"Lumenize.TimeInStateCalculator\" class=\"docClass\">Lumenize.TimeInStateCalculator</a><span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>config</span> : Object<div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Lumenize.TimeInStateCalculator\" rel=\"Lumenize.TimeInStateCalculator\" class=\"docClass\">Lumenize.TimeInStateCalculator</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-addSnapshots' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-method-addSnapshots' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-method-addSnapshots' class='name expandable'>addSnapshots</a>( <span class='pre'>snapshots, startOn, endBefore</span> ) : TimeInStateCalculator<span class=\"signature\"><span class='chainable' >chainable</span></span></div><div class='description'><div class='short'>Allows you to incrementally add snapshots to this calculator. ...</div><div class='long'><p>Allows you to incrementally add snapshots to this calculator.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>snapshots</span> : Object[]<div class='sub-desc'><p>An array of temporal data model snapshots.</p>\n</div></li><li><span class='pre'>startOn</span> : String<div class='sub-desc'><p>A ISOString (e.g. '2012-01-01T12:34:56.789Z') indicating the time start of the period of\n interest. On the second through nth call, this should equal the previous endBefore.</p>\n</div></li><li><span class='pre'>endBefore</span> : String<div class='sub-desc'><p>A ISOString (e.g. '2012-01-01T12:34:56.789Z') indicating the moment just past the time\n period of interest.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>TimeInStateCalculator</span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getResults' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-method-getResults' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-method-getResults' class='name expandable'>getResults</a>( <span class='pre'></span> ) : Object[]<span class=\"signature\"></span></div><div class='description'><div class='short'>Returns the current state of the calculator ...</div><div class='long'><p>Returns the current state of the calculator</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'>Object[]</span><div class='sub-desc'><p>Returns an Array of Maps like <code>{&lt;uniqueIDField&gt;: &lt;id&gt;, ticks: &lt;ticks&gt;, lastValidTo: &lt;lastValidTo&gt;}</code></p>\n</div></li></ul></div></div></div><div id='method-getStateForSaving' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-method-getStateForSaving' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-method-getStateForSaving' class='name expandable'>getStateForSaving</a>( <span class='pre'>[meta]</span> ) : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>Enables saving the state of this calculator. ...</div><div class='long'><p>Enables saving the state of this calculator. See class documentation for a detailed example.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>meta</span> : Object (optional)<div class='sub-desc'><p>An optional parameter that will be added to the serialized output and added to the meta field\n within the deserialized calculator.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Object</span><div class='sub-desc'><p>Returns an Ojbect representing the state of the calculator. This Object is suitable for saving to\n to an object store. Use the static method <code>newFromSavedState()</code> with this Object as the parameter to reconstitute\n the calculator.</p>\n</div></li></ul></div></div></div></div><div class='subsection'><div class='definedBy'>Defined By</div><h4 class='members-subtitle'>Static methods</h3><div id='static-method-newFromSavedState' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.TimeInStateCalculator'>Lumenize.TimeInStateCalculator</span><br/><a href='source/TimeInStateCalculator.coffee.html#Lumenize-TimeInStateCalculator-static-method-newFromSavedState' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.TimeInStateCalculator-static-method-newFromSavedState' class='name expandable'>newFromSavedState</a>( <span class='pre'>p</span> ) : TimeInStateCalculator<span class=\"signature\"><span class='static' >static</span></span></div><div class='description'><div class='short'>Deserializes a previously saved calculator and returns a new calculator. ...</div><div class='long'><p>Deserializes a previously saved calculator and returns a new calculator. See class documentation for a detailed example.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : String/Object<div class='sub-desc'><p>A String or Object from a previously saved state</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>TimeInStateCalculator</span><div class='sub-desc'>\n</div></li></ul></div></div></div></div></div></div></div>","meta":{}});