vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
1.2 KiB

/**
* Created by Alex on 9/25/2014.
*/
function DurationData() {
this.fields = ['duration','durationWithPause','durationWithStartup','durationWithBoth'];
for (var i = 0; i < this.fields.length; i++) {
this[this.fields[i]] = 0;
}
}
DurationData.prototype.setData = function(otherData) {
for (var i = 0; i < this.fields.length; i++) {
this[this.fields[i]] = otherData[this.fields[i]];
}
};
DurationData.prototype.getData = function() {
var dataObj = {};
for (var i = 0; i < this.fields.length; i++) {
dataObj[this.fields[i]] = this[this.fields[i]];
}
return dataObj;
};
DurationData.prototype.useHighest = function(otherData) {
for (var i = 0; i < this.fields.length; i++) {
var field = this.fields[i];
if (this[field] < otherData[field]) {
this[field] = otherData[field];
}
}
};
DurationData.prototype.calculateDuration = function(time, timeStart, elapsedTime, elapsedTimeWithPause, startupTime) {
this.duration = elapsedTime;
this.durationWithPause = elapsedTimeWithPause;
this.durationWithStartup = elapsedTime + startupTime.durationWithStartup;
this.durationWithBoth = elapsedTimeWithPause + startupTime.durationWithBoth;
};