using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;

namespace CoverageFramework.Operator.Selector
{
	// 複数のIXElementSelectorの結果の和をとってまとめるSelector
	public class XElementSelectorUnion : IXElementSelector
	{
		private readonly IEnumerable<IXElementSelector> _selectors;

		public XElementSelectorUnion(IEnumerable<IXElementSelector> selectors)
		{
			_selectors = selectors;
		}

		#region IXElementRangeSelector メンバ

		public IEnumerable<XElement> Select(XElement root)
		{
			return _selectors.SelectMany(s => s.Select(root));
		}

		#endregion
	}
}