StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
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.
96 lines
1.6 KiB
96 lines
1.6 KiB
4 years ago
|
'use strict';
|
||
|
|
||
|
/**
|
||
|
* Page constructor
|
||
|
*
|
||
|
* ```js
|
||
|
* var page = new Page();
|
||
|
* ```
|
||
|
*
|
||
|
* @param {Object} `page` optional page object to populate initial values.
|
||
|
* @api public
|
||
|
*/
|
||
|
|
||
|
function Page(page) {
|
||
|
if (!page) page = {};
|
||
|
for (var key in page) this[key] = page[key];
|
||
|
if (!this.hasOwnProperty('idx')) this.idx = 0;
|
||
|
if (!this.hasOwnProperty('total')) this.total = 1;
|
||
|
if (!this.hasOwnProperty('current')) {
|
||
|
this.current = this.total;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Page getters
|
||
|
*/
|
||
|
|
||
|
Object.defineProperties(Page.prototype, {
|
||
|
|
||
|
/**
|
||
|
* Helper property to determine if this is the first page in a list.
|
||
|
*/
|
||
|
|
||
|
isFirst: {
|
||
|
configurable: true,
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return this.idx === 0;
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Helper property to determine if this is the last page in a list.
|
||
|
*/
|
||
|
|
||
|
isLast: {
|
||
|
configurable: true,
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return this.idx === (this.total - 1);
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Helper property to determine if this is there is a page before this one in a list.
|
||
|
*/
|
||
|
|
||
|
hasPrevious: {
|
||
|
configurable: true,
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return !this.isFirst;
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Helper property to determine if this is there is a page before this one in a list.
|
||
|
*/
|
||
|
|
||
|
hasPrev: {
|
||
|
configurable: true,
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return !this.isFirst;
|
||
|
}
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Helper property to determine if this is there is a page after this one in a list.
|
||
|
*/
|
||
|
|
||
|
hasNext: {
|
||
|
configurable: true,
|
||
|
enumerable: true,
|
||
|
get: function() {
|
||
|
return !this.isLast;
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
/**
|
||
|
* Expose `Page`
|
||
|
*/
|
||
|
|
||
|
module.exports = Page;
|