'use strict';
var Properties = require('br/presenter/property/Properties');
/**
* @module br/presenter/node/Nodes
*/
/**
* Constructs a new <code>Nodes</code> instance containing the given list
* of {@link module:br/presenter/node/PresentationNode} objects.
*
* @class
* @alias module:br/presenter/node/Nodes
*
* @classdesc
* A class used to hold collections of nodes, and providing utility methods for
* performing operations over those collections.
*
* @param {Array} pNodes (optional) The set of nodes.
*/
function Nodes(pNodes) {
/** @private */
this.m_pNodes = pNodes || [];
}
/**
* Returns the underlying array this collection is built from.
* @type Array
*/
Nodes.prototype.getNodesArray = function() {
return this.m_pNodes;
};
/**
* Returns all properties for the nodes within this collection.
* @type br.presenter.property.Properties
*/
Nodes.prototype.properties = function() {
var oProperties = new Properties();
for (var i = 0, l = this.m_pNodes.length; i < l; ++i) {
var oPresentationNode = this.m_pNodes[i];
oProperties.add(oPresentationNode.properties());
}
return oProperties;
};
module.exports = Nodes;