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

62 lines
866 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(child) {
this.list.push(child);
}
/**
* Adds an element to the list.
*
* @param {SqlObject} element The element to add
*/
,push(element) {
this.list.push(element);
}
/**
* Removes an element from the list.
*
* @param {Number} i The element index
*/
,splice(i) {
this.list.splice(i);
}
/**
* Adds an element to the list.
*
* @param {Number} i The element index
*/
,get(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;
}
});