hedera-web/js/sql/list-holder.js

62 lines
906 B
JavaScript

/**
* Interface for array holders.
*/
module.exports = new Class({
Properties: {
/* list: {
type: Array
,set: function (x) {
this._list = x;
}
,get: function () {
return this._list;
}
}
*/
}
,list: []
,appendChild: function(child) {
this.list.push(child);
}
/**
* Adds an element to the list.
*
* @param {SqlObject} element The element to add
*/
,push: function(element) {
this.list.push(element);
}
/**
* Removes an element from the list.
*
* @param {Number} i The element index
*/
,splice: function(i) {
this.list.splice(i);
}
/**
* Adds an element to the list.
*
* @param {Number} i The element index
*/
,get: function(i) {
return this.list[i];
}
,findHolders() {
let ids = [];
for (const object of this.list){
holders = object.findHolders();
if (holders) ids = ids.concat(holders);
}
return ids;
}
});