0
1
Fork 0
hedera-web-mindshore/js/sql/list-holder.js

62 lines
866 B
JavaScript
Raw Normal View History

2022-05-30 01:30:33 +00:00
/**
* Interface for array holders.
*/
2022-06-06 08:53:59 +00:00
module.exports = new Class({
Properties: {
/* list: {
2022-05-30 01:30:33 +00:00
type: Array
2022-06-06 08:53:59 +00:00
,set: function (x) {
2022-05-30 01:30:33 +00:00
this._list = x;
}
2022-06-06 08:53:59 +00:00
,get: function () {
2022-05-30 01:30:33 +00:00
return this._list;
}
}
*/
}
,list: []
2022-11-16 01:46:44 +00:00
,appendChild(child) {
2022-06-06 08:53:59 +00:00
this.list.push(child);
2022-05-30 01:30:33 +00:00
}
/**
* Adds an element to the list.
*
* @param {SqlObject} element The element to add
*/
2022-11-16 01:46:44 +00:00
,push(element) {
2022-06-06 08:53:59 +00:00
this.list.push(element);
2022-05-30 01:30:33 +00:00
}
/**
* Removes an element from the list.
*
* @param {Number} i The element index
*/
2022-11-16 01:46:44 +00:00
,splice(i) {
2022-06-06 08:53:59 +00:00
this.list.splice(i);
2022-05-30 01:30:33 +00:00
}
/**
* Adds an element to the list.
*
* @param {Number} i The element index
*/
2022-11-16 01:46:44 +00:00
,get(i) {
2022-05-30 01:30:33 +00:00
return this.list[i];
}
2022-06-06 08:53:59 +00:00
,findHolders() {
let ids = [];
for (const object of this.list){
holders = object.findHolders();
if (holders) ids = ids.concat(holders);
}
return ids;
}
2022-05-30 01:30:33 +00:00
});