17 using System.Collections.Generic;
31 private readonly List<IUniverseSelectionModel> _universeSelectionModels =
new List<IUniverseSelectionModel>();
32 private bool _alreadyCalledCreateUniverses;
40 if (universeSelectionModels.IsNullOrEmpty())
42 throw new ArgumentException(
"Must specify at least 1 universe selection model for the CompositeUniverseSelectionModel");
45 _universeSelectionModels.AddRange(universeSelectionModels);
54 if (universeSelectionModels.IsNullOrEmpty())
56 throw new ArgumentException(
"Must specify at least 1 universe selection model for the CompositeUniverseSelectionModel");
59 foreach (var pyUniverseSelectionModel
in universeSelectionModels)
70 : this(new[] { universeSelectionModel })
81 _universeSelectionModels.Add(universeSelectionModel);
91 if (!pyUniverseSelectionModel.TryConvert(out selectionModel))
95 _universeSelectionModels.Add(selectionModel);
103 return _universeSelectionModels.Min(model => model.GetNextRefreshTimeUtc());
113 foreach (var universeSelectionModel
in _universeSelectionModels)
115 var selectionRefreshTime = universeSelectionModel.GetNextRefreshTimeUtc();
116 var refreshTime = algorithm.UtcTime >= selectionRefreshTime;
117 if (!_alreadyCalledCreateUniverses
119 || selectionRefreshTime == DateTime.MaxValue)
121 foreach (var universe
in universeSelectionModel.CreateUniverses(algorithm))
123 yield
return universe;
127 _alreadyCalledCreateUniverses =
true;