18 using System.Collections;
19 using System.Collections.Generic;
34 private bool _removedFromUniverse;
35 private readonly IEnumerator<SubscriptionData> _enumerator;
40 internal List<SubscriptionRequest> SubscriptionRequests {
get;
private set; }
50 public IEnumerable<Universe>
Universes => SubscriptionRequests
51 .Where(x => x.Universe !=
null)
52 .Select(x => x.Universe);
112 IEnumerator<SubscriptionData> enumerator,
115 SubscriptionRequests =
new List<SubscriptionRequest> { subscriptionRequest };
116 _enumerator = enumerator;
137 throw new Exception(
"Subscription.AddSubscriptionRequest(): Universe selection" +
138 " subscriptions should not have more than 1 SubscriptionRequest");
144 throw new Exception(
"Subscription.AddSubscriptionRequest(): Requesting to add" +
145 "a different SubscriptionDataConfig");
151 SubscriptionRequests.Add(subscriptionRequest);
167 IEnumerable<Universe> removedUniverses;
168 if (universe ==
null)
170 var subscriptionRequests = SubscriptionRequests;
171 SubscriptionRequests =
new List<SubscriptionRequest>();
172 removedUniverses = subscriptionRequests.Where(x => x.Universe !=
null)
173 .Select(x => x.Universe);
177 SubscriptionRequests.RemoveAll(x => x.Universe == universe);
178 removedUniverses =
new[] {universe};
181 var emptySubscription = !SubscriptionRequests.Any();
182 if (emptySubscription)
193 return emptySubscription;
210 var moveNext = _enumerator.MoveNext();
240 object IEnumerator.Current =>
Current;
249 _enumerator.DisposeSafely();
258 _removedFromUniverse =
true;
280 if (subscription ==
null)