public override void Update( EventBean[] newData, EventBean[] oldData) { _agentInstanceContext.AuditProvider.View(newData, oldData, _agentInstanceContext, _lengthWindowViewFactory); _agentInstanceContext.InstrumentationProvider.QViewProcessIRStream( _lengthWindowViewFactory, newData, oldData); EventBean[] expiredArr = null; if (oldData != null) { foreach (var anOldData in oldData) { _indexedEvents.Remove(anOldData); InternalHandleRemoved(anOldData); } expiredArr = oldData; } // add data points to the window // we don't care about removed data from a prior view if (newData != null) { foreach (var newEvent in newData) { _indexedEvents.Add(newEvent); InternalHandleAdded(newEvent); } } // Check for any events that get pushed out of the window var expiredCount = _indexedEvents.Count - Size; if (expiredCount > 0) { expiredArr = new EventBean[expiredCount]; using (var enumerator = _indexedEvents.GetEnumerator()) { for (var ii = 0; enumerator.MoveNext() && ii < expiredCount; ii++) { expiredArr[ii] = enumerator.Current; } } foreach (var anExpired in expiredArr) { _indexedEvents.Remove(anExpired); InternalHandleExpired(anExpired); } } // If there are child views, call update method if (child != null) { _agentInstanceContext.InstrumentationProvider.QViewIndicate( _lengthWindowViewFactory, newData, expiredArr); child.Update(newData, expiredArr); _agentInstanceContext.InstrumentationProvider.AViewIndicate(); } _agentInstanceContext.InstrumentationProvider.AViewProcessIRStream(); }
public override IEnumerator <EventBean> GetEnumerator() { var result = new LinkedHashSet <EventBean>(); _chain.GetAll(result, _index); return(result.GetEnumerator()); }
/// <summary> /// If there are elements in the suspectBlocks list, removes /// and returns the first one. /// </summary> /// <remarks> /// If there are elements in the suspectBlocks list, removes /// and returns the first one. Otherwise, returns null. /// </remarks> private ExtendedBlock PopNextSuspectBlock() { lock (this) { IEnumerator <ExtendedBlock> iter = suspectBlocks.GetEnumerator(); if (!iter.HasNext()) { return(null); } ExtendedBlock block = iter.Next(); iter.Remove(); return(block); } }
public void EnsureCapacity_Generic_RequestingLargerCapacity_DoesNotInvalidateEnumeration(int setLength) { LinkedHashSet <T> set = (LinkedHashSet <T>)(GenericISetFactory(setLength)); var capacity = set.EnsureCapacity(0); IEnumerator valuesEnum = set.GetEnumerator(); IEnumerator valuesListEnum = new SCG.List <T>(set).GetEnumerator(); set.EnsureCapacity(capacity + 1); // Verify EnsureCapacity does not invalidate enumeration while (valuesEnum.MoveNext()) { valuesListEnum.MoveNext(); Assert.Equal(valuesListEnum.Current, valuesEnum.Current); } }
public override IEnumerator <UpstreamDatabaseSelectionStrategy> Iterator() { IEnumerable <UpstreamDatabaseSelectionStrategy> allImplementationsOnClasspath = Service.load(typeof(UpstreamDatabaseSelectionStrategy)); LinkedHashSet <UpstreamDatabaseSelectionStrategy> candidates = new LinkedHashSet <UpstreamDatabaseSelectionStrategy>(); foreach (string key in _config.get(CausalClusteringSettings.upstream_selection_strategy)) { foreach (UpstreamDatabaseSelectionStrategy candidate in allImplementationsOnClasspath) { if (candidate.Keys.GetEnumerator().next().Equals(key)) { candidate.Inject(_topologyService, _config, _logProvider, _myself); candidates.add(candidate); } } } Log(candidates); return(candidates.GetEnumerator()); }
public override IEnumerator <EventBean> GetEnumerator() { return(_indexedEvents.GetEnumerator()); }
public override IEnumerator <EventBean> GetEnumerator() { return(CurrentBatch.GetEnumerator()); }
private List <LALRState> CreateLALRState(CachedGrammar cg) { List <LALRState> clr = CreateCLRState(cg); List <LALRState> lalr = new List <LALRState>(); int cnt = clr.Count; for (int x = 0; x < cnt; x++) { LALRState current_state = clr[x]; for (int z = x + 1; z < cnt;) { LinkedHashSet <LRxItem> xlist = current_state.items; LinkedHashSet <LRxItem> zlist = clr[z].items; IEqualityComparer <LRxItem> save = xlist.Comparer; xlist.Comparer = LRxItemComparerSlim.Instance; zlist.Comparer = LRxItemComparerSlim.Instance; if (xlist.SetEquals(zlist)) { IEnumerator <LRxItem> e1 = xlist.GetEnumerator(); while (e1.MoveNext()) { LRxItem now = e1.Current; IEnumerator <LRxItem> e2 = zlist.GetEnumerator(); while (e2.MoveNext()) { if (now.CoreEquals(e2.Current)) { now.lookahead.UnionWith(e2.Current.lookahead); break; } } e2.Dispose(); } e1.Dispose(); xlist.Comparer = save; zlist.Comparer = save; for (int a = 0; a < cnt; a++) { Map <LALRState> map = clr[a].map; KeyValuePair <int, LALRState>[] kvs = map.ToArray(); for (int b = 0, bm = kvs.Length; b < bm; b++) { if (kvs[b].Value.items.SetEquals(zlist)) { map.Add(kvs[b].Key, current_state); } } } clr.RemoveAt(z); cnt--; } else { xlist.Comparer = save; zlist.Comparer = save; z++; } } lalr.Add(current_state); } clr.Clear(); return(lalr); }
public override IEnumerator<EventBean> GetEnumerator() { ISet<EventBean> result = new LinkedHashSet<EventBean>(); factory.Chain.GetAll(result, _index); return result.GetEnumerator(); }
/// <summary> /// Iterate over loaded abbreviations. Both enabled and disabled abbreviations are listed. /// </summary> /// <returns>the abbreviations labels (e.g. Ph, Et, Me, OAc, etc.)</returns> public IEnumerator <string> GetEnumerator() => labels.GetEnumerator();