Exemple #1
0
        public override void MatchEvent(EventBean theEvent, ICollection <FilterHandle> matches)
        {
            var attributeValue = Lookupable.Getter.Get(theEvent);
            var returnValue    = new Mutable <bool>(false);

            using (Instrument.With(
                       i => i.QFilterReverseIndex(this, attributeValue),
                       i => i.AFilterReverseIndex(returnValue.Value)))
            {
                EventEvaluator evaluator = null;
                using (ConstantsMapRwLock.AcquireReadLock())
                {
                    evaluator = ConstantsMap.Get(attributeValue);
                }

                // No listener found for the value, return
                if (evaluator == null)
                {
                    returnValue.Value = false;
                }
                else
                {
                    evaluator.MatchEvent(theEvent, matches);
                    returnValue.Value = true;
                }
            }
        }
        public override void MatchEvent(EventBean theEvent, ICollection <FilterHandle> matches)
        {
            var attributeValue = Lookupable.Getter.Get(theEvent);
            var returnValue    = new Mutable <bool?>(false);

            using (Instrument.With(
                       i => i.QFilterReverseIndex(this, attributeValue),
                       i => i.AFilterReverseIndex(returnValue.Value)))
            {
                // Look up in hashtable
                using (ConstantsMapRwLock.AcquireReadLock())
                {
                    foreach (var entry in ConstantsMap)
                    {
                        if (entry.Key == null)
                        {
                            if (attributeValue != null)
                            {
                                entry.Value.MatchEvent(theEvent, matches);
                            }
                            continue;
                        }

                        if (!entry.Key.Equals(attributeValue))
                        {
                            entry.Value.MatchEvent(theEvent, matches);
                        }
                    }
                }

                returnValue.Value = null;
            }
        }